From 2589c69c04d02063bc44036163eae5bae04d95ff Mon Sep 17 00:00:00 2001 From: Slava Pestov Date: Sat, 22 Sep 2007 02:27:53 -0400 Subject: [PATCH] Unix launcher: use execvp instead of execve --- extra/io/unix/launcher/launcher.factor | 7 +++---- extra/unix/unix.factor | 1 + 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/extra/io/unix/launcher/launcher.factor b/extra/io/unix/launcher/launcher.factor index c3fe6d0a05..7b286feae1 100644 --- a/extra/io/unix/launcher/launcher.factor +++ b/extra/io/unix/launcher/launcher.factor @@ -9,16 +9,15 @@ USE: unix : with-fork ( quot -- pid ) fork [ zero? -rot if ] keep ; inline -: prepare-execve ( args -- cmd args envp ) +: prepare-execvp ( args -- cmd args ) #! Doesn't free any memory, so we only call this word #! after forking. [ malloc-char-string ] map [ first ] keep - f add >c-void*-array - f ; + f add >c-void*-array ; : (spawn-process) ( args -- ) - [ prepare-execve execve ] catch 1 exit ; + [ prepare-execvp execvp ] catch 1 exit ; : spawn-process ( args -- pid ) [ (spawn-process) ] [ drop ] with-fork ; diff --git a/extra/unix/unix.factor b/extra/unix/unix.factor index 8eb940352f..ca4b569587 100644 --- a/extra/unix/unix.factor +++ b/extra/unix/unix.factor @@ -107,6 +107,7 @@ FUNCTION: void close ( int fd ) ; FUNCTION: int connect ( int s, void* name, socklen_t namelen ) ; FUNCTION: int dup2 ( int oldd, int newd ) ; ! FUNCTION: int dup ( int oldd ) ; +FUNCTION: int execvp ( char* path, char** argv ) ; FUNCTION: int execve ( char* path, char** argv, char** envp ) ; FUNCTION: int fchdir ( int fd ) ; FUNCTION: int fchmod ( int fd, mode_t mode ) ;