From 23e7d765d7c73cbd7d6d212eb0d82f5efa6956e3 Mon Sep 17 00:00:00 2001 From: sof <unknown> Date: Mon, 26 Jan 1998 18:24:05 +0000 Subject: [PATCH] [project @ 1998-01-26 18:24:05 by sof] cygwin32: Use `native' system() instead of fork() & execl() --- ghc/lib/cbits/system.lc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/ghc/lib/cbits/system.lc b/ghc/lib/cbits/system.lc index 013f111ba676..ce99a111cbe5 100644 --- a/ghc/lib/cbits/system.lc +++ b/ghc/lib/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 /* ! cygwin32_TARGET_OS */ } \end{code} -- GitLab