diff --git a/scsh/syscalls1.c b/scsh/syscalls1.c index 0207351..5e905b6 100644 --- a/scsh/syscalls1.c +++ b/scsh/syscalls1.c @@ -71,10 +71,12 @@ s48_value wait_pid(s48_value s48_pid, s48_value s48_flags) result_pid = waitpid(pid, &status, flags); if (result_pid == -1) - s48_raise_os_error_2 (errno, s48_pid, s48_flags); - - sch_result_pid = s48_enter_integer (result_pid); - sch_status = s48_enter_integer (status); + if (errno == ECHILD) sch_result_pid = s48_enter_fixnum (0); + else s48_raise_os_error_2 (errno, s48_pid, s48_flags); + else { + sch_result_pid = s48_enter_integer (result_pid); + sch_status = s48_enter_integer (status); + } sch_status_list = s48_cons (sch_status, S48_NULL); sch_retval = s48_cons (sch_result_pid, sch_status_list); @@ -124,8 +126,8 @@ s48_value scheme_exec(s48_value prog, s48_value argv, s48_value env) } s48_stop_alarm_interrupts(); execve(s48_extract_string (prog), unix_argv, unix_env); /* Do it. */ - s48_start_alarm_interrupts(); e = errno; + s48_start_alarm_interrupts(); if( env != S48_TRUE ) { Free(unix_env); }