diff --git a/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/Execution/ProcessManager.cs b/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/Execution/ProcessManager.cs index 788be8499279..d174135b7c33 100644 --- a/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/Execution/ProcessManager.cs +++ b/tests/xharness/Microsoft.DotNet.XHarness.iOS.Shared/Execution/ProcessManager.cs @@ -250,6 +250,7 @@ static async Task KillTreeAsyncInternal (int pid, ILog log, bool? diagnostics = foreach (var diagnose_pid in pids) { var template = Path.GetTempFileName (); + var templateQuit = Path.GetTempFileName (); try { var commands = new StringBuilder (); using (var dbg = new Process ()) { @@ -259,8 +260,9 @@ static async Task KillTreeAsyncInternal (int pid, ILog log, bool? diagnostics = commands.AppendLine ("detach"); commands.AppendLine ("quit"); dbg.StartInfo.FileName = "/usr/bin/lldb"; - dbg.StartInfo.Arguments = StringUtils.FormatArguments ("--source", template); + dbg.StartInfo.Arguments = StringUtils.FormatArguments ("--source", template, "--source", templateQuit); File.WriteAllText (template, commands.ToString ()); + File.WriteAllText (templateQuit, "quit\n"); log.WriteLine ($"Printing backtrace for pid={pid}"); await RunAsyncInternal (dbg, log, log, log, TimeSpan.FromSeconds (30), diagnostics: false); @@ -268,6 +270,7 @@ static async Task KillTreeAsyncInternal (int pid, ILog log, bool? diagnostics = } finally { try { File.Delete (template); + File.Delete (templateQuit); } catch { // Don't care }