diff options
author | axel <axel@liljencrantz.se> | 2005-09-23 06:16:52 +1000 |
---|---|---|
committer | axel <axel@liljencrantz.se> | 2005-09-23 06:16:52 +1000 |
commit | f971e02256f903fa58fbc288629009d47fc89712 (patch) | |
tree | c64b639776ab294a7f17a374ddb3ad1743939a8f /proc.c | |
parent | fcdaed44d73b0f151f53a304501c987b7a649446 (diff) |
Exportable universal variables
darcs-hash:20050922201652-ac50b-f70e7607b4ace24da4020f2d432718dc335e5bdd.gz
Diffstat (limited to 'proc.c')
-rw-r--r-- | proc.c | 31 |
1 files changed, 24 insertions, 7 deletions
@@ -45,6 +45,7 @@ Some of the code in this file is based on code from the Glibc manual. #include "reader.h" #include "sanity.h" #include "env.h" +#include "parser.h" /** Size of message buffer @@ -540,7 +541,7 @@ static void handle_child_status( pid_t pid, int status ) int found_proc = 0; job_t *j; process_t *p; -// char mess[MESS_SIZE]; + char mess[MESS_SIZE]; found_proc = 0; /* snprintf( mess, @@ -587,13 +588,12 @@ static void handle_child_status( pid_t pid, int status ) } - if( !is_interactive ) + if( WIFSIGNALED( status ) && + ( WTERMSIG(status)==SIGINT || + WTERMSIG(status)==SIGQUIT ) ) { - - if( WIFSIGNALED( status ) && - ( WTERMSIG(status)==SIGINT || - WTERMSIG(status)==SIGQUIT ) ) - { + if( !is_interactive_session ) + { struct sigaction act; sigemptyset( & act.sa_mask ); act.sa_flags=0; @@ -602,6 +602,23 @@ static void handle_child_status( pid_t pid, int status ) sigaction( SIGQUIT, &act, 0 ); kill( getpid(), WTERMSIG(status) ); } + else + { + block_t *c = current_block; + + snprintf( mess, + MESS_SIZE, + "Process %ls from job %ls exited through signal, breaking loops\n", + p->actual_cmd, + j->command ); + write( 2, mess, strlen(mess )); + + while( c ) + { + c->skip=1; + c=c->outer; + } + } } if( !found_proc ) |