Merge branch 'master' of git://factorcode.org/git/factor
commit
988ae29864
|
@ -66,18 +66,18 @@ USE: unix
|
||||||
?closed write-flags 2 redirect
|
?closed write-flags 2 redirect
|
||||||
] if ;
|
] if ;
|
||||||
|
|
||||||
: spawn-process ( process -- * )
|
: setup-environment ( process -- process )
|
||||||
[
|
|
||||||
setup-priority
|
|
||||||
setup-redirection
|
|
||||||
current-directory get (normalize-path) cd
|
|
||||||
dup pass-environment? [
|
dup pass-environment? [
|
||||||
dup get-environment set-os-envs
|
dup get-environment set-os-envs
|
||||||
] when
|
] when ;
|
||||||
|
|
||||||
get-arguments exec-args-with-path
|
: spawn-process ( process -- * )
|
||||||
(io-error)
|
[ setup-priority ] [ 250 _exit ] recover
|
||||||
] [ 255 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 ;
|
M: unix current-process-handle ( -- handle ) getpid ;
|
||||||
|
|
||||||
|
|
|
@ -43,6 +43,9 @@ FUNCTION: int dup2 ( int oldd, int newd ) ;
|
||||||
FUNCTION: int execv ( char* path, char** argv ) ;
|
FUNCTION: int execv ( char* path, char** argv ) ;
|
||||||
FUNCTION: int execvp ( char* path, char** argv ) ;
|
FUNCTION: int execvp ( char* path, char** argv ) ;
|
||||||
FUNCTION: int execve ( char* path, char** argv, char** envp ) ;
|
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 fchdir ( int fd ) ;
|
||||||
FUNCTION: int fchown ( int fd, uid_t owner, gid_t group ) ;
|
FUNCTION: int fchown ( int fd, uid_t owner, gid_t group ) ;
|
||||||
FUNCTION: int fcntl ( int fd, int cmd, int arg ) ;
|
FUNCTION: int fcntl ( int fd, int cmd, int arg ) ;
|
||||||
|
|
Loading…
Reference in New Issue