[project @ 2004-10-14 14:58:50 by simonmar]
[ghc-base.git] / cbits / rawSystem.c
index 0a31546..7af7747 100644 (file)
@@ -1,6 +1,11 @@
 /* 
  * (c) The University of Glasgow 1994-2004
  *
+ * WARNING: this file is here for backwards compatibility only.  It is
+ * not included as part of the base package, but is #included into the
+ * compiler and the runghc utility when building either of these with 
+ * an old version of GHC.
+ *
  * shell-less system Runtime Support (see System.Cmd.rawSystem).
  */
 
@@ -76,10 +81,14 @@ rawSystem(HsAddr cmd)
        Since we are going to wait for the process to terminate anyway,
        there is no problem with such sharing. */
 
+      errno = EINVAL; // ToDo: wrong, caller should use GetLastError()
       return -1;
   }
   WaitForSingleObject(pInfo.hProcess, INFINITE);
-  if (GetExitCodeProcess(pInfo.hProcess, &retCode) == 0) return -1;
+  if (GetExitCodeProcess(pInfo.hProcess, &retCode) == 0) {
+      errno = EINVAL; // ToDo: wrong, caller should use GetLastError()
+      return -1;
+  }
 
   CloseHandle(pInfo.hProcess);
   CloseHandle(pInfo.hThread);