Merge branch 'master' of git://factorcode.org/git/factor

db4
Slava Pestov 2008-04-06 00:54:06 -05:00
commit 988ae29864
2 changed files with 14 additions and 11 deletions

View File

@ -66,18 +66,18 @@ USE: unix
?closed write-flags 2 redirect
] if ;
: spawn-process ( process -- * )
[
setup-priority
setup-redirection
current-directory get (normalize-path) cd
dup pass-environment? [
dup get-environment set-os-envs
] when
: setup-environment ( process -- process )
dup pass-environment? [
dup get-environment set-os-envs
] when ;
get-arguments exec-args-with-path
(io-error)
] [ 255 exit ] recover ;
: spawn-process ( process -- * )
[ setup-priority ] [ 250 _exit ] recover
[ setup-redirection ] [ 251 _exit ] recover
[ current-directory get (normalize-path) cd ] [ 252 _exit ] recover
[ setup-environment ] [ 253 _exit ] recover
[ get-arguments exec-args-with-path ] [ 254 _exit ] recover
255 _exit ;
M: unix current-process-handle ( -- handle ) getpid ;

View File

@ -43,6 +43,9 @@ FUNCTION: int dup2 ( int oldd, int newd ) ;
FUNCTION: int execv ( char* path, char** argv ) ;
FUNCTION: int execvp ( char* path, char** argv ) ;
FUNCTION: int execve ( char* path, char** argv, char** envp ) ;
: _exit ( status -- * )
#! We throw to give this a terminating stack effect.
"int" f "_exit" { "int" } alien-invoke "Exit failed" throw ;
FUNCTION: int fchdir ( int fd ) ;
FUNCTION: int fchown ( int fd, uid_t owner, gid_t group ) ;
FUNCTION: int fcntl ( int fd, int cmd, int arg ) ;