mirror of
https://github.com/neovim/neovim.git
synced 2025-09-06 03:18:16 +00:00
@@ -481,10 +481,9 @@ describe('jobs', function()
|
|||||||
eq('rows: 40, cols: 10', next_chunk())
|
eq('rows: 40, cols: 10', next_chunk())
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('calling jobclose()', function()
|
it('jobclose() sends SIGHUP', function()
|
||||||
-- this should send SIGHUP to the process
|
|
||||||
nvim('command', 'call jobclose(j)')
|
nvim('command', 'call jobclose(j)')
|
||||||
eq({'notification', 'exit', {0, 1}}, next_msg())
|
eq({'notification', 'exit', {0, 42}}, next_msg())
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
end)
|
end)
|
||||||
|
@@ -32,11 +32,21 @@ static void walk_cb(uv_handle_t *handle, void *arg) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
static void sigwinch_handler(int signum)
|
static void sig_handler(int signum)
|
||||||
{
|
{
|
||||||
int width, height;
|
switch(signum) {
|
||||||
uv_tty_get_winsize(&tty, &width, &height);
|
case SIGWINCH: {
|
||||||
fprintf(stderr, "rows: %d, cols: %d\n", height, width);
|
int width, height;
|
||||||
|
uv_tty_get_winsize(&tty, &width, &height);
|
||||||
|
fprintf(stderr, "rows: %d, cols: %d\n", height, width);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
case SIGHUP:
|
||||||
|
exit(42); // arbitrary exit code to test against
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -141,7 +151,8 @@ int main(int argc, char **argv)
|
|||||||
struct sigaction sa;
|
struct sigaction sa;
|
||||||
sigemptyset(&sa.sa_mask);
|
sigemptyset(&sa.sa_mask);
|
||||||
sa.sa_flags = 0;
|
sa.sa_flags = 0;
|
||||||
sa.sa_handler = sigwinch_handler;
|
sa.sa_handler = sig_handler;
|
||||||
|
sigaction(SIGHUP, &sa, NULL);
|
||||||
sigaction(SIGWINCH, &sa, NULL);
|
sigaction(SIGWINCH, &sa, NULL);
|
||||||
// uv_signal_t sigwinch_watcher;
|
// uv_signal_t sigwinch_watcher;
|
||||||
// uv_signal_init(uv_default_loop(), &sigwinch_watcher);
|
// uv_signal_init(uv_default_loop(), &sigwinch_watcher);
|
||||||
@@ -150,5 +161,8 @@ int main(int argc, char **argv)
|
|||||||
#endif
|
#endif
|
||||||
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
uv_run(uv_default_loop(), UV_RUN_DEFAULT);
|
||||||
|
|
||||||
|
// XXX: Without this the SIGHUP handler is skipped on some systems.
|
||||||
|
sleep(100);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user