process: make the 'status' parameter for exit_cb an int64_t
This means we no longer have to strip the high bit from the process exit code on Windows, which is problematic because an unhandled SEH exception can make a process exit with a status code that has the high bit set.
This commit is contained in:
parent
ed82eae13a
commit
66ae0ff562
@ -384,7 +384,7 @@ typedef void (*uv_async_cb)(uv_async_t* handle, int status);
|
|||||||
typedef void (*uv_prepare_cb)(uv_prepare_t* handle, int status);
|
typedef void (*uv_prepare_cb)(uv_prepare_t* handle, int status);
|
||||||
typedef void (*uv_check_cb)(uv_check_t* handle, int status);
|
typedef void (*uv_check_cb)(uv_check_t* handle, int status);
|
||||||
typedef void (*uv_idle_cb)(uv_idle_t* handle, int status);
|
typedef void (*uv_idle_cb)(uv_idle_t* handle, int status);
|
||||||
typedef void (*uv_exit_cb)(uv_process_t*, int exit_status, int term_signal);
|
typedef void (*uv_exit_cb)(uv_process_t*, int64_t exit_status, int term_signal);
|
||||||
typedef void (*uv_walk_cb)(uv_handle_t* handle, void* arg);
|
typedef void (*uv_walk_cb)(uv_handle_t* handle, void* arg);
|
||||||
typedef void (*uv_fs_cb)(uv_fs_t* req);
|
typedef void (*uv_fs_cb)(uv_fs_t* req);
|
||||||
typedef void (*uv_work_cb)(uv_work_t* req);
|
typedef void (*uv_work_cb)(uv_work_t* req);
|
||||||
|
|||||||
@ -758,9 +758,6 @@ void uv_process_proc_exit(uv_loop_t* loop, uv_process_t* handle) {
|
|||||||
} else if (!GetExitCodeProcess(handle->process_handle, &status)) {
|
} else if (!GetExitCodeProcess(handle->process_handle, &status)) {
|
||||||
/* Unable to to obtain the exit code. This should never happen. */
|
/* Unable to to obtain the exit code. This should never happen. */
|
||||||
exit_code = uv_translate_sys_error(GetLastError());
|
exit_code = uv_translate_sys_error(GetLastError());
|
||||||
} else {
|
|
||||||
/* Make sure the exit code is >= 0. */
|
|
||||||
exit_code = status & INT_MAX;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Fire the exit callback. */
|
/* Fire the exit callback. */
|
||||||
|
|||||||
@ -64,7 +64,9 @@ static void process_close_cb(uv_handle_t* handle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void exit_cb(uv_process_t* process, int exit_status, int term_signal) {
|
static void exit_cb(uv_process_t* process,
|
||||||
|
int64_t exit_status,
|
||||||
|
int term_signal) {
|
||||||
ASSERT(exit_status == 42);
|
ASSERT(exit_status == 42);
|
||||||
ASSERT(term_signal == 0);
|
ASSERT(term_signal == 0);
|
||||||
uv_close((uv_handle_t*)process, process_close_cb);
|
uv_close((uv_handle_t*)process, process_close_cb);
|
||||||
|
|||||||
@ -84,7 +84,9 @@ static void on_connection(uv_stream_t* server, int status) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void exit_cb(uv_process_t* process, int exit_status, int term_signal) {
|
static void exit_cb(uv_process_t* process,
|
||||||
|
int64_t exit_status,
|
||||||
|
int term_signal) {
|
||||||
printf("exit_cb\n");
|
printf("exit_cb\n");
|
||||||
exit_cb_called++;
|
exit_cb_called++;
|
||||||
ASSERT(exit_status == 0);
|
ASSERT(exit_status == 0);
|
||||||
|
|||||||
@ -52,7 +52,9 @@ static void close_cb(uv_handle_t* handle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void exit_cb(uv_process_t* process, int exit_status, int term_signal) {
|
static void exit_cb(uv_process_t* process,
|
||||||
|
int64_t exit_status,
|
||||||
|
int term_signal) {
|
||||||
printf("exit_cb\n");
|
printf("exit_cb\n");
|
||||||
exit_cb_called++;
|
exit_cb_called++;
|
||||||
ASSERT(exit_status == 1);
|
ASSERT(exit_status == 1);
|
||||||
@ -62,7 +64,7 @@ static void exit_cb(uv_process_t* process, int exit_status, int term_signal) {
|
|||||||
|
|
||||||
|
|
||||||
static void expect(uv_process_t* process,
|
static void expect(uv_process_t* process,
|
||||||
int exit_status,
|
int64_t exit_status,
|
||||||
int term_signal,
|
int term_signal,
|
||||||
int err) {
|
int err) {
|
||||||
printf("exit_cb\n");
|
printf("exit_cb\n");
|
||||||
@ -74,20 +76,22 @@ static void expect(uv_process_t* process,
|
|||||||
|
|
||||||
|
|
||||||
static void exit_cb_expect_enoent(uv_process_t* process,
|
static void exit_cb_expect_enoent(uv_process_t* process,
|
||||||
int exit_status,
|
int64_t exit_status,
|
||||||
int term_signal) {
|
int term_signal) {
|
||||||
expect(process, exit_status, term_signal, UV_ENOENT);
|
expect(process, exit_status, term_signal, UV_ENOENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void exit_cb_expect_eperm(uv_process_t* process,
|
static void exit_cb_expect_eperm(uv_process_t* process,
|
||||||
int exit_status,
|
int64_t exit_status,
|
||||||
int term_signal) {
|
int term_signal) {
|
||||||
expect(process, exit_status, term_signal, UV_EPERM);
|
expect(process, exit_status, term_signal, UV_EPERM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void kill_cb(uv_process_t* process, int exit_status, int term_signal) {
|
static void kill_cb(uv_process_t* process,
|
||||||
|
int64_t exit_status,
|
||||||
|
int term_signal) {
|
||||||
int err;
|
int err;
|
||||||
|
|
||||||
printf("exit_cb\n");
|
printf("exit_cb\n");
|
||||||
@ -109,7 +113,7 @@ static void kill_cb(uv_process_t* process, int exit_status, int term_signal) {
|
|||||||
ASSERT(err == UV_ESRCH);
|
ASSERT(err == UV_ESRCH);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void detach_failure_cb(uv_process_t* process, int exit_status, int term_signal) {
|
static void detach_failure_cb(uv_process_t* process, int64_t exit_status, int term_signal) {
|
||||||
printf("detach_cb\n");
|
printf("detach_cb\n");
|
||||||
exit_cb_called++;
|
exit_cb_called++;
|
||||||
}
|
}
|
||||||
@ -886,7 +890,7 @@ TEST_IMPL(spawn_setgid_fails) {
|
|||||||
#ifdef _WIN32
|
#ifdef _WIN32
|
||||||
|
|
||||||
static void exit_cb_unexpected(uv_process_t* process,
|
static void exit_cb_unexpected(uv_process_t* process,
|
||||||
int exit_status,
|
int64_t exit_status,
|
||||||
int term_signal) {
|
int term_signal) {
|
||||||
ASSERT(0 && "should not have been called");
|
ASSERT(0 && "should not have been called");
|
||||||
}
|
}
|
||||||
|
|||||||
@ -48,7 +48,9 @@ static void close_cb(uv_handle_t* handle) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void exit_cb(uv_process_t* process, int exit_status, int term_signal) {
|
static void exit_cb(uv_process_t* process,
|
||||||
|
int64_t exit_status,
|
||||||
|
int term_signal) {
|
||||||
printf("exit_cb\n");
|
printf("exit_cb\n");
|
||||||
exit_cb_called++;
|
exit_cb_called++;
|
||||||
ASSERT(exit_status == 0);
|
ASSERT(exit_status == 0);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user