shithub: Nail

Download patch

ref: a6b534a6a05d2f451427776ae7a4ff19ec539289
parent: 902da98b9797c46dd3cbb53a90ffb15699eaca88
author: Ori Bernstein <ori@eigenstate.org>
date: Sun Nov 15 20:02:11 EST 2020

create procs in same note group

If Nail dies, it usually leaves some stray processes,
which makes closing the window impossible until they're
killed. When they're in the same note group, they should
all get killed as expected.

--- a/comp.c
+++ b/comp.c
@@ -48,7 +48,7 @@
 		sysfatal("pipe: %r\n");
 
 	c->sync = chancreate(sizeof(ulong), 0);
-	proccreate(execmarshal, c, Stack);
+	procrfork(execmarshal, c, Stack, RFNOTEG);
 	recvul(c->sync);
 	chanfree(c->sync);
 	close(c->fd[0]);
--- a/mbox.c
+++ b/mbox.c
@@ -796,7 +796,7 @@
 	wintagwrite(&mbox, "Put Delmesg Undelmesg Next ");
 	showlist();
 	fprint(mbox.ctl, "clean\n");
-	proccreate(eventread, nil, Stack);
+	procrfork(eventread, nil, Stack, RFNOTEG);
 	while(1){
 		switch(alt(a)){
 		case Cevent:
@@ -871,13 +871,13 @@
 	plumbshowmailfd = plumbopen("showmail", OREAD|OCEXEC);
 
 	mbload();
-	proccreate(plumbseemail, nil, Stack);
-	proccreate(plumbshowmail, nil, Stack);
+	procrfork(plumbseemail, nil, Stack, RFNOTEG);
+	procrfork(plumbshowmail, nil, Stack, RFNOTEG);
 
 	/* avoid duplicate sends when multiple mailboxes are open */
 	if(sender || strcmp(mailbox, "mbox") == 0){
 		plumbsendmailfd = plumbopen("sendmail", OREAD|OCEXEC);
-		proccreate(plumbsendmail, nil, Stack);
+		procrfork(plumbsendmail, nil, Stack, RFNOTEG);
 	}
 	threadcreate(execlog, nil, Stack);
 	threadcreate(mbmain, nil, Stack);
--- a/mesg.c
+++ b/mesg.c
@@ -208,7 +208,7 @@
 		sysfatal("pipe: %r");
 	m->sync = chancreate(sizeof(ulong), 0);
 	m->path = path;
-	proccreate(execfmt, m, Stack);
+	procrfork(execfmt, m, Stack, RFNOTEG);
 	recvul(m->sync);
 	chanfree(m->sync);
 	close(m->fd[1]);