vis
a vi-like editor based on Plan 9's structural regular expressions
git clone https://9o.is/git/vis.git
commit 18bd3231cc6dbf7e455937b6e0b2fe0d5d35d62e parent 66fdfa420da8a39747b1e04b70fd6d17c223d3fd Author: Marc André Tanner <mat@brain-dump.org> Date: Mon, 15 Feb 2021 16:16:20 +0100 vis: correctly close pipe connected to stdin of external process Once we have written all data we should properly close the (correct) pipe. Before we wrongly closed the pipe connected to the standard output stream. More generally, we currently do not listen for child process termination, but instead wait until all the connected pipes are closed. This might be problematic in case the external process keeps hold of the standard I/O file descriptors. One particular example of this is wl-copy(1). See #929 Diffstat:
| M | vis.c | | | 4 | ++-- |
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/vis.c b/vis.c @@ -1860,8 +1860,8 @@ int vis_pipe(Vis *vis, File *file, Filerange *range, const char *argv[], if (len > 0) { rout.start += len; if (text_range_size(&rout) == 0) { - close(pout[1]); - pout[1] = -1; + close(pin[1]); + pin[1] = -1; } } else { close(pin[1]);