Ejemplo n.º 1
0
int uv_process_kill(uv_process_t* process, int signum) {
  int err;

  if (process->process_handle == INVALID_HANDLE_VALUE) {
    return UV_EINVAL;
  }

  err = uv__kill(process->process_handle, signum);
  if (err) {
    return err;  /* err is already translated. */
  }

  process->exit_signal = signum;

  return 0;
}
Ejemplo n.º 2
0
Archivo: process.c Proyecto: Ankso/node
uv_err_t uv_kill(int pid, int signum) {
  uv_err_t err;
  HANDLE process_handle = OpenProcess(PROCESS_TERMINATE |
    PROCESS_QUERY_INFORMATION, FALSE, pid);

  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);
  CloseHandle(process_handle);

  return err;
}
Ejemplo n.º 3
0
Archivo: process.c Proyecto: Ankso/node
int uv_process_kill(uv_process_t* process, int signum) {
  uv_err_t err;

  if (process->process_handle == INVALID_HANDLE_VALUE) {
    uv__set_artificial_error(process->loop, UV_EINVAL);
    return -1;
  }

  err = uv__kill(process->process_handle, signum);

  if (err.code != UV_OK) {
    uv__set_error(process->loop, err.code, err.sys_errno_);
    return -1;
  }

  process->exit_signal = signum;

  return 0;
}
Ejemplo n.º 4
0
int uv_kill(int pid, int signum) {
  int err;
  HANDLE process_handle = OpenProcess(PROCESS_TERMINATE |
    PROCESS_QUERY_INFORMATION, FALSE, pid);

  if (process_handle == NULL) {
    err = GetLastError();
    if (err == ERROR_INVALID_PARAMETER) {
      return UV_ESRCH;
    } else {
      return uv_translate_sys_error(err);
    }
  }

  err = uv__kill(process_handle, signum);
  CloseHandle(process_handle);

  return err;  /* err is already translated. */
}