Open jaredpar opened 9 months ago
Probably need to change Stop-Process
to be
function Stop-Processes() {
Write-Host 'Killing running build processes Roslyn style...'
foreach ($processName in $processesToStopOnExit) {
Get-Process -Name $processName -ErrorAction SilentlyContinue
? { $_.ProcessId -ne $PID }
| Stop-Process
}
}
Really though, why we blanket kill dotnet
here? What are we trying to achieve that forces us to do this?
Really though, why we blanket kill
dotnet
here? What are we trying to achieve that forces us to do this?
I'm not sure of the history but suspect the process clean up is intended to ensure files are released before builds create artefacts.
In any case, there might be a workaround: Your builds could create a variable named processesToStopOnExit
that's an array of string
s naming what you want stopped. The default is @('msbuild', 'dotnet', 'vbcscompiler')
. Passing @('msbuild', 'vbcscompiler')
might do the trick for you @jaredpar.
If not, this seems like a quick fix. Feel free to open a PR 😁
The implementation of
ExitWithExitCode
means that we cannot usepwsh
as a local tool in our repos. The implementation kills a number of processes, includingdotnet
. That means when you execute a script withdotnet pwsh example.ps1
theExitWithExitCode
will kill itself.Example:
Put that script in the root of a repo then execute it: