Skip to content

Commit 9f52c65

Browse files
rolfbjarnemandel-macaque
authored andcommitted
[xharness] Improve process killing a bit. (#9120)
* Log what we're doing. * Wait a bit after sending SIGABRT, to allow for the OS to create any crash reports.
1 parent 0e5e7da commit 9f52c65

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/Execution/ProcessManager.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,12 +280,19 @@ static async Task KillTreeAsyncInternal (int pid, ILog log, bool? diagnostics =
280280

281281
// Send SIGABRT since that produces a crash report
282282
// lldb may fail to attach to system processes, but crash reports will still be produced with potentially helpful stack traces.
283-
for (int i = 0; i < pids.Count; i++)
283+
for (int i = 0; i < pids.Count; i++) {
284+
log.WriteLine ($"kill -6 {pids [i]}");
284285
kill (pids [i], 6);
286+
}
287+
288+
// Wait a little bit for the OS to process the SIGABRTs
289+
await Task.Delay (TimeSpan.FromSeconds (5));
285290

286291
// send kill -9 anyway as a last resort
287-
for (int i = 0; i < pids.Count; i++)
292+
for (int i = 0; i < pids.Count; i++) {
293+
log.WriteLine ($"kill -9 {pids [i]}");
288294
kill (pids [i], 9);
295+
}
289296
}
290297

291298
static async Task<bool> WaitForExitAsync (Process process, TimeSpan? timeout = null)

0 commit comments

Comments
 (0)