diff --git a/src/main.c b/src/main.c index d08543f..011dcae 100644 --- a/src/main.c +++ b/src/main.c @@ -79,7 +79,7 @@ void sig_handler (int signo); volatile bool g_abort = false; // signal handler void sig_handler (int signo){ - if (signo == SIGINT){ + if (signo == SIGINT || signo == SIGTERM){ g_abort = true; } } @@ -175,6 +175,7 @@ int main ( else if(command==COMMAND_ENSTROPHY){ // register signal handler to handle aborts signal(SIGINT, sig_handler); + signal(SIGTERM, sig_handler); enstrophy(parameters.K1, parameters.K2, parameters.N1, parameters.N2, parameters.final_time, parameters.nu, parameters.delta, parameters.L, parameters.adaptive_tolerance, parameters.adaptive_factor, u0, g, parameters.irreversible, parameters.algorithm, parameters.print_freq, parameters.starting_time, nthreads, savefile, (char*)argv[0], param_str, savefile_str); } else if(command==COMMAND_QUIET){