/*
- * (c) The GRASP/AQUA Project, Glasgow University, 1994-1998
+ * (c) The University of Glasgow 1994-2003
*
- * $Id: rawSystem.c,v 1.1 2002/08/28 13:59:19 simonmar Exp $
- *
- * shell-less system Runtime Support
+ * shell-less system Runtime Support (see System.Cmd.rawSystem).
*/
/* The itimer stuff in this module is non-posix */
#include <windows.h>
#endif
+#ifdef HAVE_VFORK_H
+#include <vfork.h>
+#endif
+
+#ifdef HAVE_VFORK
+#define fork vfork
+#endif
+
+#if defined(mingw32_TARGET_OS)
+/* -------------------- WINDOWS VERSION --------------------- */
+
HsInt
-rawSystemCmd(HsAddr cmd)
+rawSystem(HsAddr cmd)
{
- /* -------------------- WINDOWS VERSION --------------------- */
-#if defined(mingw32_TARGET_OS)
STARTUPINFO sInfo;
PROCESS_INFORMATION pInfo;
DWORD retCode;
CloseHandle(pInfo.hProcess);
CloseHandle(pInfo.hThread);
return retCode;
+}
#else
- /* -------------------- UNIX VERSION --------------------- */
+/* -------------------- UNIX VERSION --------------------- */
+
+HsInt
+rawSystem(HsAddr cmd, HsAddr args)
+{
int pid;
int wstat;
switch(pid = fork()) {
case -1:
- if (errno != EINTR) {
+ {
return -1;
}
case 0:
#endif
/* the child */
- execl(cmd, NULL);
+ execvp(cmd, args);
_exit(127);
}
}
/* This should never happen */
}
return -1;
-#endif
}
+#endif