handle interrupts and backgrounded processes a little better.

This commit is contained in:
rsc 2004-03-26 17:30:36 +00:00
parent 25e0e4f334
commit 69ab5d3d49
3 changed files with 11 additions and 1 deletions

View file

@ -386,7 +386,13 @@ notifyf(void *unused0, char *s)
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)

View file

@ -137,3 +137,4 @@ int ndot;
char *getstatus(void);
int lastc;
int lastword;
int kidpid;

View file

@ -63,6 +63,7 @@ void Xsimple(void){
Xerror("try again");
return;
case 0:
rfork(RFNOTEG);
pushword("exec");
execexec();
strcpy(buf, "can't exec: ");
@ -70,10 +71,12 @@ void Xsimple(void){
errstr(buf+n, ERRMAX-n);
Exit(buf);
default:
kidpid = pid;
poplist();
/* interrupts don't get us out */
while(Waitfor(pid, 1) < 0)
;
kidpid = 0;
}
}
}