summaryrefslogtreecommitdiff
path: root/driver/ghci/ghci.c
diff options
context:
space:
mode:
Diffstat (limited to 'driver/ghci/ghci.c')
-rw-r--r--driver/ghci/ghci.c13
1 files changed, 11 insertions, 2 deletions
diff --git a/driver/ghci/ghci.c b/driver/ghci/ghci.c
index ebf13d8ba7..a603655ec8 100644
--- a/driver/ghci/ghci.c
+++ b/driver/ghci/ghci.c
@@ -11,6 +11,16 @@ BOOL fileExists(const char *path) {
return r != INVALID_FILE_ATTRIBUTES && !(r & FILE_ATTRIBUTE_DIRECTORY);
}
+/* 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;
char *exePath;
@@ -33,6 +43,5 @@ int main(int argc, char** argv) {
exePath = mkString("%s/ghc-stage2.exe", binDir);
}
- run(exePath, 1, preArgv, argc - 1, argv + 1);
+ run(exePath, 1, preArgv, argc - 1, argv + 1, ReleaseResource);
}
-