FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Close FileStream opened to read file go get hash. by rkeithhill · Pull Request #4175 · PowerShell/PowerShell · GitHub

Close FileStream opened to read file go get hash. - #4175

Merged
Jason Shirk (lzybkr) merged 1 commit into
PowerShell:masterfrom
rkeithhill:rkeithhill/fix-get-filehash-open-handle
Jul 7, 2017
Merged

Close FileStream opened to read file go get hash.#4175
Jason Shirk (lzybkr) merged 1 commit into
PowerShell:masterfrom
rkeithhill:rkeithhill/fix-get-filehash-open-handle

Conversation

Copy link
Copy Markdown
Collaborator

Fix #4174

try
{
Stream openfilestream = File.OpenRead(path);
openfilestream = File.OpenRead(path);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

How about 'using' instead?

Keith Hill (rkeithhill) commented Jul 2, 2017
edited
Loading

Copy link
Copy Markdown
Collaborator Author

I went with that approach first but with the catch statement it seemed to read better with try/catch/finally than try {using()} / catch. That said, I can certainly remove the finally and put a using statement inside the try. It's about six of one / half dozen the other. :-)

Copy link
Copy Markdown
Collaborator

LGTM.

Copy link
Copy Markdown
Member

Keith Hill (@rkeithhill) looking at the entire file, keeping it try...finally is probably more consistent with other try...catch usage in this file, so LGTM

Copy link
Copy Markdown
Collaborator Author

Sure would be nice to get this fix into beta.4. Got some Plaster users on Linux who are hitting this bug.

Jason Shirk (lzybkr) merged commit fa02e84 into PowerShell:master Jul 7, 2017
Keith Hill (rkeithhill) deleted the rkeithhill/fix-get-filehash-open-handle branch May 29, 2019 15:21
Thatgfsj (Thatgfsj) pushed a commit to Thatgfsj/PowerShell that referenced this pull request Aug 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants


Back | FazBrowse Home | New Git URL