aboutsummaryrefslogtreecommitdiff
path: root/src/cmd/acme/ecmd.c
diff options
context:
space:
mode:
authorrsc <devnull@localhost>2006-05-05 04:55:14 +0000
committerrsc <devnull@localhost>2006-05-05 04:55:14 +0000
commit663017560218b62119022f9f4360cf6eb05a36e2 (patch)
treee38c0d7cda94f06bde1327af7f804d04b506906a /src/cmd/acme/ecmd.c
parent11b0772a33026b44fd0a7f8a8d757d2f6a218878 (diff)
downloadplan9port-663017560218b62119022f9f4360cf6eb05a36e2.tar.gz
plan9port-663017560218b62119022f9f4360cf6eb05a36e2.tar.bz2
plan9port-663017560218b62119022f9f4360cf6eb05a36e2.zip
fix edit pipe bug
Diffstat (limited to 'src/cmd/acme/ecmd.c')
-rw-r--r--src/cmd/acme/ecmd.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/cmd/acme/ecmd.c b/src/cmd/acme/ecmd.c
index ac578235..a507b50f 100644
--- a/src/cmd/acme/ecmd.c
+++ b/src/cmd/acme/ecmd.c
@@ -592,6 +592,7 @@ runpipe(Text *t, int cmd, Rune *cr, int ncr, int state)
int n;
Runestr dir;
Window *w;
+ QLock *q;
r = skipbl(cr, ncr, &n);
if(n == 0)
@@ -626,6 +627,23 @@ runpipe(Text *t, int cmd, Rune *cr, int ncr, int state)
winunlock(t->w);
qunlock(&row.lk);
recvul(cedit);
+ /*
+ * The editoutlk exists only so that we can tell when
+ * the editout file has been closed. It can get closed *after*
+ * the process exits because, since the process cannot be
+ * connected directly to editout (no 9P kernel support),
+ * the process is actually connected to a pipe to another
+ * process (arranged via 9pserve) that reads from the pipe
+ * and then writes the data in the pipe to editout using
+ * 9P transactions. This process might still have a couple
+ * writes left to copy after the original process has exited.
+ */
+ if(w)
+ q = &w->editoutlk;
+ else
+ q = &editoutlk;
+ qlock(q); /* wait for file to close */
+ qunlock(q);
qlock(&row.lk);
editing = Inactive;
if(t!=nil && t->w!=nil)