Skip to content

Commit eadcb1b

Browse files
committed
Raise SIGTERM again
Fixes some exit status issue and makes sure that `WIFSIGNALED()` and `WTERMSIG()` can be used as expected
1 parent 5f2a241 commit eadcb1b

1 file changed

Lines changed: 3 additions & 5 deletions

File tree

src/client.c

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -245,11 +245,8 @@ const char* rimraf_tmpdir_cmd = NULL;
245245
void term_handler(int n) {
246246
R_system(rimraf_tmpdir_cmd);
247247

248-
// We don't run finalization handlers because running R code from a
249-
// signal handler is not safe. To properly clean up a process, we'd
250-
// need R to handle SIGTERM and clean up at check-interrupt
251-
// time. We do run `atexit()` handlers though.
252-
exit(-SIGTERM);
248+
// Continue signal
249+
raise(SIGTERM);
253250
}
254251

255252
void install_term_handler(void) {
@@ -286,6 +283,7 @@ void install_term_handler(void) {
286283

287284
struct sigaction sig = {{ 0 }};
288285
sig.sa_handler = term_handler;
286+
sig.sa_flags = SA_RESETHAND;
289287
sigaction(SIGTERM, &sig, NULL);
290288
}
291289

0 commit comments

Comments
 (0)