Commit b6e553d3 authored by Yuras's avatar Yuras
Browse files

Close pipes on failure

When we fail to create communication pipe, we should cleanup resources
before exit. E.g. we should close pipes for stdin, stdout and stderr if
they where created. Fixes #122.
parent ad4f0e72
......@@ -111,6 +111,18 @@ runInteractiveProcess (char *const args[],
r = pipe(forkCommunicationFds);
if (r == -1) {
*failed_doing = "runInteractiveProcess: pipe";
if (fdStdIn == -1) {
close(fdStdInput[0]);
close(fdStdInput[1]);
}
if (fdStdOut == -1) {
close(fdStdOutput[0]);
close(fdStdOutput[1]);
}
if (fdStdErr == -1) {
close(fdStdError[0]);
close(fdStdError[1]);
}
return -1;
}
......
......@@ -2,6 +2,9 @@
## Unreleased changes
* Bug fix: Don't leak pipes on failure
[#122](https://github.com/haskell/process/issues/122)
## 1.6.3.0 *January 2018*
* Added `getPid` and export of platform specific `Pid` type
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment