[io/win] Ensure no-console flag is not used if stdio is inherited.
Follow-up to b6c5e52af6771762aa593b333fd1185f66674658 that fixes broken test.
TEST=process_inherit_stdio_test
Change-Id: Ice2188af03f3230d0b8d1161fedce333e43b862b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237482
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
diff --git a/runtime/bin/process_win.cc b/runtime/bin/process_win.cc
index d5814a8..1811456 100644
--- a/runtime/bin/process_win.cc
+++ b/runtime/bin/process_win.cc
@@ -554,12 +554,17 @@
if (!Process::ModeIsAttached(mode_)) {
creation_flags |= DETACHED_PROCESS;
} else {
- // Ensure that if console needs to be created, it is created hidden.
- // Normally stdout for console dart application is associated with console
- // that is launched from, but for gui applications(flutter on windows)
- // console might be absent, will be created by CreateProcessW below.
- // When that happens we ensure that console window doesn't pop up.
- creation_flags |= CREATE_NO_WINDOW;
+ // Unless we are inherting stdio which means there is some console
+ // associated with the app, we want to ensure no console window pops
+ // up for the spawned child.
+ if (mode_ != kInheritStdio) {
+ // Normally stdout for console dart application is associated with a
+ // console that is launched from, but for gui applications(flutter on
+ // windows) console might be absent, will be created by CreateProcessW
+ // below. When that happens we ensure that console window doesn't
+ // pop up.
+ creation_flags |= CREATE_NO_WINDOW;
+ }
}
BOOL result = CreateProcessW(
NULL, // ApplicationName