handle interrupts and backgrounded processes a little better.
diff --git a/src/cmd/rc/plan9ish.c b/src/cmd/rc/plan9ish.c
index 30fa896..2b9011c 100644
--- a/src/cmd/rc/plan9ish.c
+++ b/src/cmd/rc/plan9ish.c
@@ -386,7 +386,13 @@
int i;
for(i=0;syssigname[i];i++)
if(strncmp(s, syssigname[i], strlen(syssigname[i]))==0){
- if(strncmp(s, "sys: ", 5)!=0) interrupted=1;
+ if(strncmp(s, "sys: ", 5)!=0){
+ if(kidpid && !interrupted){
+ interrupted=1;
+ postnote(PNGROUP, kidpid, s);
+ }
+ interrupted = 1;
+ }
goto Out;
}
if(strcmp(s, "sys: child") != 0)
diff --git a/src/cmd/rc/rc.h b/src/cmd/rc/rc.h
index 7df5fea..9a73927 100644
--- a/src/cmd/rc/rc.h
+++ b/src/cmd/rc/rc.h
@@ -137,3 +137,4 @@
char *getstatus(void);
int lastc;
int lastword;
+int kidpid;
diff --git a/src/cmd/rc/simple.c b/src/cmd/rc/simple.c
index c85c909..85b20c3 100644
--- a/src/cmd/rc/simple.c
+++ b/src/cmd/rc/simple.c
@@ -63,6 +63,7 @@
Xerror("try again");
return;
case 0:
+ rfork(RFNOTEG);
pushword("exec");
execexec();
strcpy(buf, "can't exec: ");
@@ -70,10 +71,12 @@
errstr(buf+n, ERRMAX-n);
Exit(buf);
default:
+ kidpid = pid;
poplist();
/* interrupts don't get us out */
while(Waitfor(pid, 1) < 0)
;
+ kidpid = 0;
}
}
}