Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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

Merged
lzybkr merged 1 commit into
PowerShell:masterPowerShell/PowerShell:masterfrom
rkeithhill:rkeithhill/fix-get-filehash-open-handlerkeithhill/PowerShell:rkeithhill/fix-get-filehash-open-handleCopy head branch name to clipboard
Jul 7, 2017
Merged

Close FileStream opened to read file go get hash.#4175
lzybkr merged 1 commit into
PowerShell:masterPowerShell/PowerShell:masterfrom
rkeithhill:rkeithhill/fix-get-filehash-open-handlerkeithhill/PowerShell:rkeithhill/fix-get-filehash-open-handleCopy head branch name to clipboard

Conversation

@rkeithhill

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.

How about 'using' instead?

@rkeithhill

rkeithhill commented Jul 2, 2017

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. :-)

@iSazonov

iSazonov commented Jul 3, 2017

Copy link
Copy Markdown
Collaborator

LGTM.

@SteveL-MSFT

Copy link
Copy Markdown
Member

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

@rkeithhill

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.

@lzybkr lzybkr merged commit fa02e84 into PowerShell:master Jul 7, 2017
@rkeithhill rkeithhill deleted the rkeithhill/fix-get-filehash-open-handle branch May 29, 2019 15:21
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

Morty Proxy This is a proxified and sanitized view of the page, visit original site.