From 0cccd6ef42b99d00c51a865c8fbf72ad9bd02958 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Andr=C3=A9=20Tanner?= Date: Mon, 15 Feb 2021 16:16:20 +0100 Subject: 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 --- vis.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'vis.c') diff --git a/vis.c b/vis.c index 45963b0..cc61754 100644 --- 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]); -- cgit v1.2.3