Skip to content

Commit 9aa9d4e

Browse files
Fix process invocation for PowerShell handler (#1080)
* Replaced the method of process awaiting
1 parent 7898b15 commit 9aa9d4e

File tree

3 files changed

+8
-12
lines changed

3 files changed

+8
-12
lines changed

powershell/VstsTaskSdk/ToolFunctions.ps1

+2-6
Original file line numberDiff line numberDiff line change
@@ -202,13 +202,9 @@ function Invoke-Process {
202202
$processOptions.Add("RedirectStandardError", $StdErrPath)
203203
}
204204

205-
# TODO: For some reason, -Wait is not working on agent.
206-
# Agent starts executing the System usage metrics and hangs the step forever.
205+
# We can't use -Wait in this case as it waits for the whole process tree, it can lead to unexprected hangs
207206
$proc = Start-Process @processOptions
208-
209-
# https://stackoverflow.com/a/23797762
210-
$null = $($proc.Handle)
211-
$proc.WaitForExit()
207+
Wait-Process -InputObject $proc
212208

213209
$procExitCode = $proc.ExitCode
214210
Write-Verbose "Exit code: $procExitCode"

powershell/package-lock.json

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

powershell/package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vsts-task-sdk",
3-
"version": "0.21.1",
3+
"version": "0.21.2",
44
"private": true,
55
"scripts": {
66
"build": "node make.js build",
@@ -16,6 +16,6 @@
1616
"mocha": "5.2.0",
1717
"nodejs-file-downloader": "^4.11.1",
1818
"shelljs": "^0.8.5",
19-
"typescript": "^4.0.2"
19+
"typescript": "4.0.2"
2020
}
2121
}

0 commit comments

Comments
 (0)