GeezerVisonThe World Wide Web, restored to 800 pixels of glory. | |||||||||||||||||||||||||||||||||||||
| Home|About|Gaming cabinet|Archives|How it works|Starter sites | |||||||||||||||||||||||||||||||||||||
GeezerVison is showing github.com — Add a generic file watcher function in HelpersCommon.psm1 by daxian-dbw · Pull Request #4775 · PowerShell/PowerShell Conversation
Member
Fix #4524 Add a generic file watcher function in HelpersCommon.psm1 and update some tests to use the
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
Dongbo Wang (daxian-dbw)
requested a review
from Aditya Patwardhan (adityapatwardhan)
as a code owner
Dongbo Wang (daxian-dbw)
removed the request for review
from Aditya Patwardhan (adityapatwardhan)
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting, make sense to enhance
Sorry, something went wrong. Uh oh!
There was an error while loading. Please reload this page. All reactions
|
| $startTime = [DateTime]::Now | ||
|
|
||
| # Loop until the file is present | ||
| while (-not (Test-Path $File)) { |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Maybe use Wait-UntilTrue? We duplicate code here.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Good point. I will change it.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
| while (((Get-Date) - $startTime).TotalSeconds -lt 10 -and (-not (Test-Path "$HOME/nativeCommandProcessor.Success"))) { | ||
| Start-Sleep -Milliseconds 100 | ||
| } | ||
| Wait-FileToBePresent -File "$HOME/nativeCommandProcessor.Success" -TimeoutInSeconds 10 -IntervalInMilliseconds 100 > $null |
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Every use we add ">$null" - so maybe do this internally in Wait-FileToBePresent ? If we need we could add -Passthrou
And why not use Out-Null? It is optimized for pipelines.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
The reason will be displayed to describe this comment to others. Learn more.
Will change to ignore output in Wait-FileToBePresent. -PassThru can be added when there is a need coming up.
As for Out-Null, I think the optimization was to make Out-Null same as > $null when it's the last command in a pipeline, namely writing to null pipe directly without going through the cmdlet.
Sorry, something went wrong.
There was an error while loading. Please reload this page.
|
The failure in AppVeyor is a known issue. It's fixed by #4806 |
Sorry, something went wrong.
There was an error while loading. Please reload this page.
…#4775) Add a generic file watcher function in HelpersCommon.psm1 and update some tests to use the `Wait-FileToBePresent`.
There was an error while loading. Please reload this page.
Successfully merging this pull request may close these issues.
There was an error while loading. Please reload this page.