Commit 4d579945 authored by sof's avatar sof
Browse files

[project @ 2005-05-05 00:58:38 by sof]

[mingw only]
Provide (unsatisfying) workaround for pesky Ctrl-C issue, whereby a
cygwin-based bash will terminate the 'ghci.exe' wrapper without the
wrapper process getting a chance to respond (and shut down its child,
if nothing else.) The result instead being that the child (ghc.exe) ends up
lingering in the background.

To steer users away from such badness, the wrapper checks to see whether
it is running in a *nix-like shell, and if it is, issue a warning that
it would be better to invoke GHCi using the 'ghcii.sh' shell script instead.

Merge to STABLE.
parent 2c77fa71
#-----------------------------------------------------------------------------
# $Id: Makefile,v 1.10 2002/01/10 10:33:48 sof Exp $
# $Id: Makefile,v 1.11 2005/05/05 00:58:38 sof Exp $
#
TOP=../..
......@@ -40,6 +40,7 @@ SCRIPT_SUBST_VARS = GHCBIN TOPDIROPT
ifneq "$(TARGETPLATFORM)" "i386-unknown-mingw32"
INSTALL_SCRIPTS += $(SCRIPT_PROG)
else
INSTALL_SCRIPTS += ghcii.sh
INSTALL_PROGS += $(C_PROG)
endif
TOPDIROPT = -B$(GHCLIB)
......
/*
*
* $Id: ghci.c,v 1.9 2005/04/22 17:15:51 sof Exp $
* $Id: ghci.c,v 1.10 2005/05/05 00:58:38 sof Exp $
*
* ghci wrapper for Win32 only
*
......@@ -74,6 +74,12 @@ main(int argc, char** argv)
ZeroMemory(&si, sizeof(STARTUPINFO));
si.cb = sizeof(STARTUPINFO);
if ( getenv("_") ) {
printf("WARNING: GHCi invoked via 'ghci.exe' in *nix-like shells (cygwin-bash, in particular)\n");
printf(" doesn't handle Ctrl-C well; use the 'ghcii.sh' shell wrapper instead\n");
fflush(stdout);
}
/* Locate the binary we want to start up */
if ( !SearchPath(NULL,
BINARY_NAME,
......@@ -81,7 +87,7 @@ main(int argc, char** argv)
dwSize,
(char*)binPath,
&szEnd) ) {
errmsg("Unable to locate ghc.exe");
errmsg1("%s: Unable to locate ghc.exe", argv[0]);
return 1;
}
......@@ -89,7 +95,7 @@ main(int argc, char** argv)
/* Turn the path into short form - LFN form causes problems
when passed in argv[0]. */
if ( !(GetShortPathName(binPath, binPathShort, dwSize)) ) {
errmsg("Unable to locate ghc.exe");
errmsg1("%s: Unable to locate ghc.exe", argv[0]);
return 1;
}
......@@ -101,7 +107,7 @@ main(int argc, char** argv)
}
new_cmdline = (char*)malloc(sizeof(char) * (cmdline_len + 1));
if (!new_cmdline) {
errmsg("failed to start up ghc.exe; insufficient memory");
errmsg1("%s: failed to start up ghc.exe; insufficient memory", argv[0]);
return 1;
}
......
#!/bin/sh
# Mini-driver for GHCi
exec $0/../ghc --interactive ${1+"$@"}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment