Update src/lcpex/liblcpex.cpp

master
Christopher M. Punches 2024-02-08 10:02:53 +00:00
parent e9556c6075
commit 74bce85f1e
1 changed files with 3 additions and 0 deletions

View File

@ -324,6 +324,9 @@ int execute(
// wait for child to exit, capture status
waitpid(pid, &status, 0);
// Drain the pipes before exiting
while (read_from_pipe(fd_child_stdout_pipe[READ_END], buf, BUFFER_SIZE) > 0);
while (read_from_pipe(fd_child_stderr_pipe[READ_END], buf, BUFFER_SIZE) > 0);
if WIFEXITED(status) {
return WEXITSTATUS(status);