Add launcher error codes
							parent
							
								
									ab5ebd0f5a
								
							
						
					
					
						commit
						d2468ad9ed
					
				| 
						 | 
				
			
			@ -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 "Exit failed" throw ] 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 ;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -43,7 +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 ) ;
 | 
			
		||||
FUNCTION: int _exit ( int status ) ;
 | 
			
		||||
: _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 ) ;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue