Check fork() error code

db4
Slava Pestov 2008-02-05 17:07:37 -06:00
parent 4297777e19
commit be39d64ef8
1 changed files with 3 additions and 2 deletions

View File

@ -8,7 +8,8 @@ IN: unix.process
! to implement io.launcher on Unix. User code should use
! io.launcher instead.
: >argv ( seq -- alien ) [ malloc-char-string ] map f add >c-void*-array ;
: >argv ( seq -- alien )
[ malloc-char-string ] map f add >c-void*-array ;
: exec ( pathname argv -- int )
[ malloc-char-string ] [ >argv ] bi* execv ;
@ -29,7 +30,7 @@ IN: unix.process
>r [ first ] [ ] bi r> exec-with-env ;
: with-fork ( child parent -- )
fork dup zero? -roll swap curry if ; inline
fork dup io-error dup zero? -roll swap curry if ; inline
: wait-for-pid ( pid -- status )
0 <int> [ 0 waitpid drop ] keep *int WEXITSTATUS ;