From: sof Date: Mon, 9 Feb 1998 09:07:32 +0000 (+0000) Subject: [project @ 1998-02-09 09:07:32 by sof] X-Git-Tag: Approx_2487_patches~982 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=2701c66e9621f2830bee825c95530f66db2b97d2;hp=1d210d0a6343a0e755b7bf1f1d9e7e959e2eba81;p=ghc-hetmet.git [project @ 1998-02-09 09:07:32 by sof] Re-commit of cygwin32 fix --- diff --git a/ghc/lib/std/cbits/system.lc b/ghc/lib/std/cbits/system.lc index 013f111..924c8d4 100644 --- a/ghc/lib/std/cbits/system.lc +++ b/ghc/lib/std/cbits/system.lc @@ -24,6 +24,21 @@ StgInt systemCmd(cmd) StgByteArray cmd; { +#if defined(cygwin32_TARGET_OS) + /* The implementation of std. fork() has its problems + under cygwin32-b18, so we fall back on using libc's + system() instead. (It in turn has problems, as it + does not wait until the sub shell has finished before + returning. Using sleep() works around that.) + */ + if (system(cmd) < 0) { + cvtErrno(); + stdErrno(); + return -1; + } + sleep(1); + return 0; +#else int pid; int wstat; @@ -60,6 +75,7 @@ StgByteArray cmd; ghc_errstr = "internal error (process neither exited nor signalled)"; } return -1; +#endif } \end{code}