aboutsummaryrefslogtreecommitdiffhomepage
path: root/builtin.c
diff options
context:
space:
mode:
authorGravatar axel <axel@liljencrantz.se>2005-10-12 05:23:43 +1000
committerGravatar axel <axel@liljencrantz.se>2005-10-12 05:23:43 +1000
commit838ba08eaa883026d6fb88cd65dde33b16a564fd (patch)
tree164ec92c2b27f82e7fced328e5f0922813645d00 /builtin.c
parent0a4b983afa4137da9392b2bb198a02f6d1df38f7 (diff)
Event handling and job reaping updates
darcs-hash:20051011192343-ac50b-aa3f5ae5e2b34d122f10e3b59ceb6fdd447f4ae3.gz
Diffstat (limited to 'builtin.c')
-rw-r--r--builtin.c23
1 files changed, 13 insertions, 10 deletions
diff --git a/builtin.c b/builtin.c
index f621611a..394231b9 100644
--- a/builtin.c
+++ b/builtin.c
@@ -748,7 +748,11 @@ static int builtin_function( wchar_t **argv )
}
,
{
- L"on-exit", required_argument, 0, 'x'
+ L"on-job-exit", required_argument, 0, 'j'
+ }
+ ,
+ {
+ L"on-process-exit", required_argument, 0, 'p'
}
,
{
@@ -767,7 +771,7 @@ static int builtin_function( wchar_t **argv )
int opt = wgetopt_long( argc,
argv,
- L"bd:s:x:v:",
+ L"bd:s:j:p:v:",
long_options,
&opt_index );
if( opt == -1 )
@@ -848,7 +852,8 @@ static int builtin_function( wchar_t **argv )
break;
}
- case 'x':
+ case 'j':
+ case 'p':
{
pid_t pid;
wchar_t *end;
@@ -864,15 +869,13 @@ static int builtin_function( wchar_t **argv )
woptarg );
res=1;
break;
- }
-
-
+ }
e = malloc( sizeof(event_t));
if( !e )
die_mem();
e->type = EVENT_EXIT;
- e->pid = pid;
+ e->pid = (opt=='j'?-1:1)*abs(pid);
e->function_name=0;
al_push( events, e );
break;
@@ -2252,7 +2255,7 @@ static int builtin_jobs( wchar_t **argv )
/*
Ignore unconstructed jobs, i.e. ourself.
*/
- if( j->constructed )
+ if( j->constructed /*&& j->skip_notification*/ )
{
if( !found )
{
@@ -2269,12 +2272,12 @@ static int builtin_jobs( wchar_t **argv )
found = 1;
sb_printf( sb_out, L"%d\t%d\t", j->job_id, j->pgid );
-
-
+
#ifdef HAVE__PROC_SELF_STAT
sb_printf( sb_out, L"%d\t", cpu_use(j) );
#endif
sb_append2( sb_out, job_is_stopped(j)?L"stopped\t":L"running\t",
+// job_is_completed(j)?L"completed\t":L"unfinished\t",
j->command, L"\n", (void *)0 );
}