diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2015-07-18 09:46:14 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2015-08-13 07:41:04 -0300 |
commit | b13011ff47d9af019c74681edb5a1a42736ee7d7 (patch) | |
tree | 3af913d9b906ed3c39a1cca0138d81ca3d20faa8 /src | |
parent | 024b1f39a31c09f3460a1af13062f1920b323f61 (diff) | |
download | rneovim-b13011ff47d9af019c74681edb5a1a42736ee7d7.tar.gz rneovim-b13011ff47d9af019c74681edb5a1a42736ee7d7.tar.bz2 rneovim-b13011ff47d9af019c74681edb5a1a42736ee7d7.zip |
pty_process: Simplify cleanup after error during spawn
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/event/pty_process.c | 18 |
1 files changed, 2 insertions, 16 deletions
diff --git a/src/nvim/event/pty_process.c b/src/nvim/event/pty_process.c index 1e24d7c919..0aa0d6fbd4 100644 --- a/src/nvim/event/pty_process.c +++ b/src/nvim/event/pty_process.c @@ -33,9 +33,6 @@ # include "event/pty_process.c.generated.h" #endif -static const unsigned int KILL_RETRIES = 5; -static const unsigned int KILL_TIMEOUT = 2; // seconds - bool pty_process_spawn(PtyProcess *ptyproc) FUNC_ATTR_NONNULL_ALL { @@ -83,19 +80,8 @@ bool pty_process_spawn(PtyProcess *ptyproc) error: close(master); - - // terminate spawned process - kill(pid, SIGTERM); - int status, child; - unsigned int try = 0; - while (try++ < KILL_RETRIES && !(child = waitpid(pid, &status, WNOHANG))) { - sleep(KILL_TIMEOUT); - } - if (child != pid) { - kill(pid, SIGKILL); - waitpid(pid, NULL, 0); - } - + kill(pid, SIGKILL); + waitpid(pid, NULL, 0); return false; } |