2 % (c) The GRASP/AQUA Project, Glasgow University, 1995
4 \subsection[system.lc]{system Runtime Support}
11 #ifdef HAVE_SYS_WAIT_H
27 #if defined(cygwin32_TARGET_OS)
28 /* The implementation of std. fork() has its problems
29 under cygwin32-b18, so we fall back on using libc's
30 system() instead. (It in turn has problems, as it
31 does not wait until the sub shell has finished before
32 returning. Using sleep() works around that.)
34 if (system(cmd) < 0) {
45 switch(pid = fork()) {
54 execl("/bin/sh", "sh", "-c", cmd, NULL);
58 while (waitpid(pid, &wstat, 0) < 0) {
67 return WEXITSTATUS(wstat);
68 else if (WIFSIGNALED(wstat)) {
69 ghc_errtype = ERR_INTERRUPTED;
70 ghc_errstr = "system command interrupted";
73 /* This should never happen */
74 ghc_errtype = ERR_OTHERERROR;
75 ghc_errstr = "internal error (process neither exited nor signalled)";