summaryrefslogtreecommitdiff
path: root/hadrian/bindist/cwrappers/version-wrapper.c
diff options
context:
space:
mode:
Diffstat (limited to 'hadrian/bindist/cwrappers/version-wrapper.c')
-rw-r--r--hadrian/bindist/cwrappers/version-wrapper.c18
1 files changed, 17 insertions, 1 deletions
diff --git a/hadrian/bindist/cwrappers/version-wrapper.c b/hadrian/bindist/cwrappers/version-wrapper.c
index f91c4c7f83..335be4e9d0 100644
--- a/hadrian/bindist/cwrappers/version-wrapper.c
+++ b/hadrian/bindist/cwrappers/version-wrapper.c
@@ -2,6 +2,17 @@
#include "cwrapper.h"
#include "getLocation.h"
#include <stddef.h>
+#include <windows.h>
+
+/* In order for this console program to pass on full event processing to called
+ process we need to remove it from the current console. Since we want the
+ child to inherit the handles so redirection etc all work we need to detach
+ from the console after the child has been created. However we don't want to
+ detach from the console in non-interactive scenarios otherwise we'll hit
+ #13411 again. So we only detach when we're sure we need to, see #14150. */
+void ReleaseResource(void) {
+ FreeConsole();
+}
int main(int argc, char** argv) {
char *binDir;
@@ -10,5 +21,10 @@ int main(int argc, char** argv) {
binDir = getExecutablePath();
exePath = mkString("%s/%s", binDir, EXE_PATH);
- run(exePath, 0, NULL, argc - 1, argv + 1, NULL);
+ run(exePath, 0, NULL, argc - 1, argv + 1,
+#if INTERACTIVE_PROCESS
+ ReleaseResource);
+#else
+ NULL);
+#endif
}