handle interrupts and backgrounded processes a little better.
This commit is contained in:
parent
25e0e4f334
commit
69ab5d3d49
3 changed files with 11 additions and 1 deletions
|
|
@ -386,7 +386,13 @@ notifyf(void *unused0, char *s)
|
||||||
int i;
|
int i;
|
||||||
for(i=0;syssigname[i];i++)
|
for(i=0;syssigname[i];i++)
|
||||||
if(strncmp(s, syssigname[i], strlen(syssigname[i]))==0){
|
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;
|
goto Out;
|
||||||
}
|
}
|
||||||
if(strcmp(s, "sys: child") != 0)
|
if(strcmp(s, "sys: child") != 0)
|
||||||
|
|
|
||||||
|
|
@ -137,3 +137,4 @@ int ndot;
|
||||||
char *getstatus(void);
|
char *getstatus(void);
|
||||||
int lastc;
|
int lastc;
|
||||||
int lastword;
|
int lastword;
|
||||||
|
int kidpid;
|
||||||
|
|
|
||||||
|
|
@ -63,6 +63,7 @@ void Xsimple(void){
|
||||||
Xerror("try again");
|
Xerror("try again");
|
||||||
return;
|
return;
|
||||||
case 0:
|
case 0:
|
||||||
|
rfork(RFNOTEG);
|
||||||
pushword("exec");
|
pushword("exec");
|
||||||
execexec();
|
execexec();
|
||||||
strcpy(buf, "can't exec: ");
|
strcpy(buf, "can't exec: ");
|
||||||
|
|
@ -70,10 +71,12 @@ void Xsimple(void){
|
||||||
errstr(buf+n, ERRMAX-n);
|
errstr(buf+n, ERRMAX-n);
|
||||||
Exit(buf);
|
Exit(buf);
|
||||||
default:
|
default:
|
||||||
|
kidpid = pid;
|
||||||
poplist();
|
poplist();
|
||||||
/* interrupts don't get us out */
|
/* interrupts don't get us out */
|
||||||
while(Waitfor(pid, 1) < 0)
|
while(Waitfor(pid, 1) < 0)
|
||||||
;
|
;
|
||||||
|
kidpid = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue