Skip to content

Commit ddfc763

Browse files
rmarinhoCopilot
andcommitted
Fix emulator stdout/stderr pipe inheritance in StartAvd
Redirect stdout/stderr on the emulator process so it doesn't inherit the caller's pipes. Without this, parent processes (e.g. VS Code spawn with stdio:'pipe') never see the 'close' event because the emulator holds the pipes open indefinitely. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
1 parent 95566bd commit ddfc763

1 file changed

Lines changed: 6 additions & 0 deletions

File tree

src/Xamarin.Android.Tools.AndroidSdk/Runners/EmulatorRunner.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,12 @@ public Process StartAvd (string avdName, bool coldBoot = false, string? addition
6868
var psi = ProcessUtils.CreateProcessStartInfo (emulatorPath, args.ToArray ());
6969
ConfigureEnvironment (psi);
7070

71+
// Redirect stdout/stderr so the emulator process doesn't inherit the
72+
// caller's pipes. Without this, parent processes (e.g. VS Code spawn)
73+
// never see the 'close' event because the emulator holds the pipes open.
74+
psi.RedirectStandardOutput = true;
75+
psi.RedirectStandardError = true;
76+
7177
var process = new Process { StartInfo = psi };
7278
process.Start ();
7379

0 commit comments

Comments
 (0)