summaryrefslogtreecommitdiff
path: root/driver/ghci/ghci.c
diff options
context:
space:
mode:
authorKavon Farvardin <kavon@farvard.in>2018-09-23 15:29:37 -0500
committerKavon Farvardin <kavon@farvard.in>2018-09-23 15:29:37 -0500
commit84c2ad99582391005b5e873198b15e9e9eb4f78d (patch)
treecaa8c2f2ec7e97fbb4977263c6817c9af5025cf4 /driver/ghci/ghci.c
parent8ddb47cfcf5776e9a3c55fd37947c8a95e00fa12 (diff)
parente68b439fe5de61b9a2ca51af472185c62ccb8b46 (diff)
downloadhaskell-wip/T13904.tar.gz
update to current master againwip/T13904
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);
}
-