aboutsummaryrefslogtreecommitdiffhomepage
path: root/proc.c
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2005-10-15 10:51:26 +1000
committerGravatar axel <axel@liljencrantz.se>2005-10-15 10:51:26 +1000
commit9298f610f6f26425db36d8727ad533d660a6c5d6 (patch)
tree53c6f257f99c7e35c0975744edf5ca7d4e10818f /proc.c
parent638df31ca462b032d59bde586254be5f3dc21e35 (diff)
Add support for specifying event handler for calling job in command supstitution. Add psub shellscript function for process substitution
darcs-hash:20051015005126-ac50b-d2aedca3a50a78362502f3fa9dd8bf25cb7dc6e1.gz
Diffstat (limited to 'proc.c')
-rw-r--r--proc.c11
1 files changed, 6 insertions, 5 deletions
diff --git a/proc.c b/proc.c
index 3f188ad8..bc27a214 100644
--- a/proc.c
+++ b/proc.c
@@ -482,7 +482,7 @@ static void format_job_info( const job_t *j, const wchar_t *status )
fwprintf (stdout, L"\n" );
}
-static void fire_process_event( const wchar_t *msg, pid_t pid, int status )
+static void fire_process_event( const wchar_t *msg, int type, pid_t pid, int status )
{
static event_t ev;
event_t e;
@@ -490,7 +490,7 @@ static void fire_process_event( const wchar_t *msg, pid_t pid, int status )
e.function_name=0;
- ev.type=EVENT_EXIT;
+ ev.type=type;
ev.param1.pid = pid;
al_push( &event_arg, msg );
@@ -516,7 +516,7 @@ int job_reap( int interactive )
locked++;
if( locked>1 )
- return;
+ return 0;
for( j=first_job; j; j=jnext)
{
@@ -539,7 +539,7 @@ int job_reap( int interactive )
s = p->status;
- fire_process_event( L"PROCESS_EXIT", p->pid, ( WIFSIGNALED(s)?-1:WEXITSTATUS( s )) );
+ fire_process_event( L"PROCESS_EXIT", EVENT_EXIT, p->pid, ( WIFSIGNALED(s)?-1:WEXITSTATUS( s )) );
if( WIFSIGNALED(s) )
{
@@ -597,7 +597,8 @@ int job_reap( int interactive )
found=1;
}
}
- fire_process_event( L"JOB_EXIT", -j->pgid, 0 );
+ fire_process_event( L"JOB_EXIT", EVENT_EXIT, -j->pgid, 0 );
+ fire_process_event( L"JOB_EXIT", EVENT_JOB_ID, j->job_id, 0 );
job_free(j);
}