Skip to content
This repository has been archived by the owner on May 4, 2018. It is now read-only.

Commit

Permalink
Add UV_ESRCH
Browse files Browse the repository at this point in the history
Fixes #239.
  • Loading branch information
tj authored and ry committed Nov 9, 2011
1 parent b7da0a6 commit a378110
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion include/uv.h
Expand Up @@ -116,7 +116,8 @@ typedef enum {
UV_EAISERVICE,
UV_EAISOCKTYPE,
UV_ESHUTDOWN,
UV_EEXIST
UV_EEXIST,
UV_ESRCH
} uv_err_code;

typedef enum {
Expand Down
2 changes: 2 additions & 0 deletions src/unix/error.c
Expand Up @@ -79,6 +79,7 @@ static int uv__translate_lib_error(int code) {
case UV_ENOTCONN: return ENOTCONN;
case UV_EEXIST: return EEXIST;
case UV_EHOSTUNREACH: return EHOSTUNREACH;
case UV_ESRCH: return ESRCH;
default: return -1;
}

Expand Down Expand Up @@ -112,6 +113,7 @@ uv_err_code uv_translate_sys_error(int sys_errno) {
case EEXIST: return UV_EEXIST;
case EHOSTUNREACH: return UV_EHOSTUNREACH;
case EAI_NONAME: return UV_ENOENT;
case ESRCH: return UV_ESRCH;
default: return UV_UNKNOWN;
}

Expand Down
6 changes: 4 additions & 2 deletions test/test-spawn.c
Expand Up @@ -68,11 +68,13 @@ static void kill_cb(uv_process_t* process, int exit_status, int term_signal) {
ASSERT(no_term_signal || term_signal == 15);
uv_close((uv_handle_t*)process, close_cb);

/* Sending signum == 0 should check if the
/*
* Sending signum == 0 should check if the
* child process is still alive, not kill it.
* This process should be dead.
*/
err = uv_kill(process->pid, 0);
ASSERT(err.code != UV_OK);
ASSERT(err.code == UV_ESRCH);
}


Expand Down

0 comments on commit a378110

Please sign in to comment.