diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/nvim/eval.c | 1 | ||||
| -rw-r--r-- | src/nvim/event/libuv_process.c | 6 | ||||
| -rw-r--r-- | src/nvim/event/process.c | 6 | ||||
| -rw-r--r-- | src/nvim/event/process.h | 1 | ||||
| -rw-r--r-- | src/nvim/os/pty_process_unix.c | 2 | ||||
| -rw-r--r-- | src/nvim/os/pty_process_win.c | 2 | 
6 files changed, 12 insertions, 6 deletions
| diff --git a/src/nvim/eval.c b/src/nvim/eval.c index 77347d4701..d0d447f053 100644 --- a/src/nvim/eval.c +++ b/src/nvim/eval.c @@ -12354,7 +12354,6 @@ static void f_jobstop(typval_T *argvars, typval_T *rettv, FunPtr fptr)      return;    } -    Channel *data = find_job(argvars[0].vval.v_number, true);    if (!data) {      return; diff --git a/src/nvim/event/libuv_process.c b/src/nvim/event/libuv_process.c index ffe2db9b76..63efee59a8 100644 --- a/src/nvim/event/libuv_process.c +++ b/src/nvim/event/libuv_process.c @@ -101,6 +101,10 @@ static void close_cb(uv_handle_t *handle)  static void exit_cb(uv_process_t *handle, int64_t status, int term_signal)  {    Process *proc = handle->data; -  proc->status = (int)status; +#if defined(WIN32) +  // Use stored/expected signal. +  term_signal = proc->exit_signal; +#endif +  proc->status = term_signal ? 128 + term_signal : (int)status;    proc->internal_exit_cb(proc);  } diff --git a/src/nvim/event/process.c b/src/nvim/event/process.c index 4410deadef..c31ecdaddf 100644 --- a/src/nvim/event/process.c +++ b/src/nvim/event/process.c @@ -159,7 +159,7 @@ void process_close_streams(Process *proc) FUNC_ATTR_NONNULL_ALL  ///                 0 for no wait. -1 to wait until the process quits.  /// @return Exit code of the process. proc->status will have the same value.  ///         -1 if the timeout expired while the process is still running. -///         -2 if the user interruped the wait. +///         -2 if the user interrupted the wait.  int process_wait(Process *proc, int ms, MultiQueue *events)    FUNC_ATTR_NONNULL_ARG(1)  { @@ -220,6 +220,7 @@ void process_stop(Process *proc) FUNC_ATTR_NONNULL_ALL      return;    }    proc->stopped_time = os_hrtime(); +  proc->exit_signal = SIGTERM;    switch (proc->type) {      case kProcessTypeUv: @@ -253,8 +254,10 @@ static void children_kill_cb(uv_timer_t *handle)      }      uint64_t term_sent = UINT64_MAX == proc->stopped_time;      if (kProcessTypePty != proc->type || term_sent) { +      proc->exit_signal = SIGKILL;        os_proc_tree_kill(proc->pid, SIGKILL);      } else { +      proc->exit_signal = SIGTERM;        os_proc_tree_kill(proc->pid, SIGTERM);        proc->stopped_time = UINT64_MAX;  // Flag: SIGTERM was sent.        // Restart timer. @@ -403,4 +406,3 @@ static void on_process_stream_close(Stream *stream, void *data)    Process *proc = data;    decref(proc);  } - diff --git a/src/nvim/event/process.h b/src/nvim/event/process.h index 13dc3839ce..ef9d953ab7 100644 --- a/src/nvim/event/process.h +++ b/src/nvim/event/process.h @@ -19,6 +19,7 @@ struct process {    Loop *loop;    void *data;    int pid, status, refcount; +  uint8_t exit_signal;  // Signal used when killing (on Windows).    uint64_t stopped_time;  // process_stop() timestamp    const char *cwd;    char **argv; diff --git a/src/nvim/os/pty_process_unix.c b/src/nvim/os/pty_process_unix.c index 5fdf0e6181..f0bc13783c 100644 --- a/src/nvim/os/pty_process_unix.c +++ b/src/nvim/os/pty_process_unix.c @@ -288,7 +288,7 @@ static void chld_handler(uv_signal_t *handle, int signum)      if (WIFEXITED(stat)) {        proc->status = WEXITSTATUS(stat);      } else if (WIFSIGNALED(stat)) { -      proc->status = WTERMSIG(stat); +      proc->status = 128 + WTERMSIG(stat);      }      proc->internal_exit_cb(proc);    } diff --git a/src/nvim/os/pty_process_win.c b/src/nvim/os/pty_process_win.c index c5f8efadff..290668bca3 100644 --- a/src/nvim/os/pty_process_win.c +++ b/src/nvim/os/pty_process_win.c @@ -252,7 +252,7 @@ static void pty_process_finish2(PtyProcess *ptyproc)    DWORD exit_code = 0;    GetExitCodeProcess(ptyproc->process_handle, &exit_code); -  proc->status = (int)exit_code; +  proc->status = proc->exit_signal ? 128 + proc->exit_signal : (int)exit_code;    CloseHandle(ptyproc->process_handle);    ptyproc->process_handle = NULL; | 
