diff --git a/src/core/f-stubs.c b/src/core/f-stubs.c index 5cbf1aad8a..2bccd0d5fe 100644 --- a/src/core/f-stubs.c +++ b/src/core/f-stubs.c @@ -864,6 +864,10 @@ ** */ REBVAL *Make_OS_Error(int errnum) /* +** Creates Rebol string from error number. +** If errnum is zero, the number of last error will be resolved +** using system functions. +** ***********************************************************************/ { REBCHR str[100]; diff --git a/src/os/posix/host-lib.c b/src/os/posix/host-lib.c index 4a99d7aab3..8d99b69d0c 100644 --- a/src/os/posix/host-lib.c +++ b/src/os/posix/host-lib.c @@ -420,6 +420,7 @@ int pipe2(int pipefd[2], int flags); //to avoid "implicit-function-declaration" ** ***********************************************************************/ { + if (!errnum) errnum = errno; strerror_r(errnum, s_cast(str), len); return str; } @@ -1280,9 +1281,14 @@ static int Try_Browser(char *browser, REBCHR *url) exit(1); break; default: - waitpid(pid, &status, WUNTRACED); - result = WIFEXITED(status) + sleep(1); // needed else WEXITSTATUS sometimes reports value 127 + if (0 > waitpid(pid, &status, WUNTRACED)) { + result = FALSE; + } else { + printf("status: %i WIFEXITED: %i WEXITSTATUS: %i\n", status, WIFEXITED(status), WEXITSTATUS(status) ); + result = WIFEXITED(status) && (WEXITSTATUS(status) == 0); + } } return result;