From: Richard M K. <kr...@us...> - 2007-12-19 02:28:20
|
Update of /cvsroot/sbcl/sbcl/src/runtime In directory sc8-pr-cvs8.sourceforge.net:/tmp/cvs-serv13257/src/runtime Modified Files: run-program.c Log Message: 1.0.12.37: RUN-PROGRAM now uses execvp(3) to search for executables * RUN-PROGRAM now uses execvp(3) in the child, rather than a Lisp function in SBCL, to search for an executable to run. This makes RUN-PROGRAM slightly closer to most other languages' process creation facilities. * The function FIND-EXECUTABLE-IN-SEARCH-PATH has been removed. A note is added to the manual pointing users who need the old, idiosyncratic search behavior to look for it it in the CVS history. Index: run-program.c =================================================================== RCS file: /cvsroot/sbcl/sbcl/src/runtime/run-program.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- run-program.c 3 Mar 2007 00:42:03 -0000 1.15 +++ run-program.c 19 Dec 2007 02:28:13 -0000 1.16 @@ -54,8 +54,9 @@ return 1; } -int spawn(char *program, char *argv[], char *envp[], char *pty_name, - int stdin, int stdout, int stderr) +extern char **environ; +int spawn(char *program, char *argv[], int stdin, int stdout, int stderr, + int search, char *envp[], char *pty_name, int wait) { int pid = fork(); int fd; @@ -112,16 +113,14 @@ close(fd); #endif + environ = envp; /* Exec the program. */ - execve(program, argv, envp); - - /* It didn't work, so try /bin/sh. */ - argv[0] = program; - argv[-1] = "sh"; - execve("/bin/sh", argv-1, envp); + if (search) + execvp(program, argv); + else + execv(program, argv); - /* The exec didn't work, flame out. */ - exit(1); + exit (1); } #else /* !LISP_FEATURE_WIN32 */ @@ -149,6 +148,9 @@ int in, int out, int err, + int search, + char *envp, + char *ptyname, int wait ) { @@ -187,7 +189,10 @@ } /* Spawn process given on the command line*/ - hProcess = (HANDLE) spawnvp ( wait_mode, program, argv ); + if (search) + hProcess = (HANDLE) spawnvp ( wait_mode, program, argv ); + else + hProcess = (HANDLE) spawnv ( wait_mode, program, argv ); /* Now that the process is launched, replace the original * in/out/err handles and close the backups. */ |