Added better constrol over waiting for editor
This commit is contained in:
parent
187eb22b99
commit
0a2bb25700
2 changed files with 13 additions and 4 deletions
|
@ -5,6 +5,7 @@
|
|||
)
|
||||
|
||||
begin {
|
||||
$global:WaitForEditor = (($WaitForEditor, 0 -ne $null)[0], 5 -ne 0)[0]
|
||||
$PathForEditor = @()
|
||||
}
|
||||
process {
|
||||
|
@ -29,7 +30,15 @@ end {
|
|||
|
||||
if( $editor -match 'code(\.exe)?"$' ) {
|
||||
if( -not (Get-Process -Name 'code' -ErrorAction SilentlyContinue) ) {
|
||||
Invoke-ExpressionEx -sudo:$sudo $editor
|
||||
Invoke-ExpressionEx -sudo:$sudo "& $editor"
|
||||
while( -not (Get-Process -Name 'code' -ErrorAction SilentlyContinue) ) {
|
||||
Start-Sleep -Seconds 1
|
||||
}
|
||||
Write-Host -ForegroundColor DarkCyan "Please wait, initializing editor..."
|
||||
Start-Sleep -Seconds $WaitForEditor
|
||||
if( Test-Path variable:EditorWaitStopWatch ) {
|
||||
$EditorWaitStopWatch.Restart()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue