Skip to content

List dotnet processes about to be killed #20526

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions eng/scripts/KillProcesses.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ function _killSeleniumTrackedProcesses() {
}
}

function _listProcesses($processName) {
$processes = Get-WmiObject win32_process -Filter "name like '%$processName'" -ErrorAction SilentlyContinue;
if ($processes) {
Write-Host "These processes will be killed..."
$processes | select commandline | Out-String -Width 800
}
}

_listProcesses dotnet
_kill dotnet.exe
_kill testhost.exe
_kill iisexpress.exe
Expand Down
8 changes: 8 additions & 0 deletions eng/scripts/KillProcesses.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
#!/usr/bin/env bash

# list processes that would be killed so they appear in the log
p=$(pgrep dotnet)
if [ $? -eq 0 ]
then
echo "These processes will be killed..."
ps -p $p
fi

pkill dotnet || true
exit 0