summaryrefslogtreecommitdiffstats
path: root/otherlibs/win32unix/createprocess.c
diff options
context:
space:
mode:
authorXavier Leroy <xavier.leroy@inria.fr>1996-09-17 14:43:05 +0000
committerXavier Leroy <xavier.leroy@inria.fr>1996-09-17 14:43:05 +0000
commit5266f760449e6c8a2572e7caef83d1d03cd97fda (patch)
treef4d3ff548dbe958ddc13d84cc2c402c8c289beec /otherlibs/win32unix/createprocess.c
parent1685e9fa9dc52d96938b4579327863db8ccbae03 (diff)
close_on.c: reecriture complete
createprocess.c: chercher dans le PATH unix.ml: il faut deux \000 a la fin d'un bloc d'environnement winwait.c: le PID renvoye n'etait pas bon. git-svn-id: http://caml.inria.fr/svn/ocaml/trunk@985 f963ae5c-01c2-4b8c-9fe0-0dff7051ff02
Diffstat (limited to 'otherlibs/win32unix/createprocess.c')
-rw-r--r--otherlibs/win32unix/createprocess.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/otherlibs/win32unix/createprocess.c b/otherlibs/win32unix/createprocess.c
index c49b3da8f..8f44254db 100644
--- a/otherlibs/win32unix/createprocess.c
+++ b/otherlibs/win32unix/createprocess.c
@@ -15,13 +15,18 @@
#include <mlvalues.h>
#include "unixsupport.h"
-value win_create_process_native(exe, cmdline, env, fd1, fd2, fd3)
- value exe, cmdline, env, fd1, fd2, fd3;
+/* From the Caml runtime */
+extern char * searchpath(char * name);
+
+value win_create_process_native(cmd, cmdline, env, fd1, fd2, fd3)
+ value cmd, cmdline, env, fd1, fd2, fd3;
{
PROCESS_INFORMATION pi;
STARTUPINFO si;
- char * envp;
+ char * exefile, * envp;
+ exefile = searchpath(String_val(cmd));
+ if (exefile == NULL) exefile = String_val(cmd);
if (env != Val_int(0)) {
envp = String_val(Field(env, 0));
} else {
@@ -33,10 +38,10 @@ value win_create_process_native(exe, cmdline, env, fd1, fd2, fd3)
si.hStdInput = (HANDLE) _get_osfhandle(Int_val(fd1));
si.hStdOutput = (HANDLE) _get_osfhandle(Int_val(fd2));
si.hStdError = (HANDLE) _get_osfhandle(Int_val(fd3));
- if (! CreateProcess(String_val(exe), String_val(cmdline), NULL, NULL,
+ if (! CreateProcess(exefile, String_val(cmdline), NULL, NULL,
TRUE, 0, envp, NULL, &si, &pi)) {
_dosmaperr(GetLastError());
- uerror("create_process", exe);
+ uerror("create_process", exefile);
}
return Val_int(pi.hProcess);
}