commit ec339d3b08eb1bb0da4ebe5c763b36a165642c00
parent 3218d8358ae81aa5b1599b4cc5d87405afe8934b
Author: Benno Schulenberg <bensberg@telfort.nl>
Date: Sun, 19 Aug 2018 09:54:16 +0200
filtering: wait for the data-sending process to terminate too
When piping the buffer (or the marked region) to an external command,
we should wait not only for the external command to terminate but also
for the data-sending process, so that it will release its resources.
This fixes https://savannah.gnu.org/bugs/?54499.
With-help-from: Marco Diego Aurélio Mesquita <marcodiegomesquita@gmail.com>
Diffstat:
1 file changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/text.c b/src/text.c
@@ -1241,8 +1241,11 @@ bool execute_command(const char *command)
openfile->undotop->strdata = mallocstrcpy(NULL, _("filtering"));
}
+ /* Wait for the external command (and possibly data sender) to terminate. */
if (wait(NULL) == -1)
nperror("wait");
+ if (should_pipe && (wait(NULL) == -1))
+ nperror("wait");
/* If it was changed, restore the handler for SIGINT. */
if (!setup_failed && sigaction(SIGINT, &oldaction, NULL) == -1)