Permalink
Browse files

Windows: return UV_ESRCH from uv_kill

  • Loading branch information...
piscisaureus committed Nov 9, 2011
1 parent a378110 commit 2b7774ae49b73baccc43aff9c532443412fb51e3
Showing with 13 additions and 6 deletions.
  1. +13 −6 src/win/process.c
View
@@ -1082,14 +1082,17 @@ static uv_err_t uv__kill(HANDLE process_handle, int signum) {
}
} else if (signum == 0) {
/* Health check: is the process still alive? */
- if (GetExitCodeProcess(process_handle, &status) &&
- status == STILL_ACTIVE) {
- err = uv_ok_;
+ if (GetExitCodeProcess(process_handle, &status)) {
+ if (status == STILL_ACTIVE) {
+ err = uv_ok_;
+ } else {
+ err = uv__new_artificial_error(UV_ESRCH);
+ }
} else {
err = uv__new_sys_error(GetLastError());
}
} else {
- err.code = UV_ENOSYS;
+ err = uv__new_artificial_error(UV_ENOSYS);
}
return err;
@@ -1122,8 +1125,12 @@ uv_err_t uv_kill(int pid, int signum) {
HANDLE process_handle = OpenProcess(PROCESS_TERMINATE |
PROCESS_QUERY_INFORMATION, FALSE, pid);
- if (process_handle == INVALID_HANDLE_VALUE) {
- return uv__new_sys_error(GetLastError());
+ if (process_handle == NULL) {
+ if (GetLastError() == ERROR_INVALID_PARAMETER) {
+ return uv__new_artificial_error(UV_ESRCH);
+ } else {
+ return uv__new_sys_error(GetLastError());
+ }
}
err = uv__kill(process_handle, signum);

0 comments on commit 2b7774a

Please sign in to comment.