diff options
author | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-05-13T08·30+0200 |
---|---|---|
committer | Eelco Dolstra <eelco.dolstra@logicblox.com> | 2015-05-13T08·30+0200 |
commit | 9233ac7c565bd370fee8681414461bda2558fa07 (patch) | |
tree | bbc6c6c043ab09ab825a30852a631fdd37bf9884 | |
parent | 71083f9e5ecfb94d110664499d87cea3e6c61b2e (diff) | |
parent | dad754843aad61ea4e92e4c3111ca432de4511f5 (diff) |
Merge pull request #537 from garbas/master
cygwin fixes
-rw-r--r-- | src/libstore/build.cc | 1 | ||||
-rw-r--r-- | src/libstore/local-store.cc | 1 | ||||
-rw-r--r-- | src/libutil/util.cc | 20 |
3 files changed, 12 insertions, 10 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc index 2d81f72c12ab..50c59c1314d9 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -20,6 +20,7 @@ #include <sys/types.h> #include <sys/stat.h> #include <sys/utsname.h> +#include <sys/select.h> #include <fcntl.h> #include <unistd.h> #include <errno.h> diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index 91149b30f742..1dcd7228f347 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -13,6 +13,7 @@ #include <sys/types.h> #include <sys/stat.h> +#include <sys/select.h> #include <sys/time.h> #include <unistd.h> #include <utime.h> diff --git a/src/libutil/util.cc b/src/libutil/util.cc index ab0a3b303076..5cda9a0677b5 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -942,16 +942,16 @@ string runProgram(Path program, bool searchPath, const Strings & args, checkInterrupt(); /* Create a pipe. */ - Pipe stdout, stdin; - stdout.create(); - if (!input.empty()) stdin.create(); + Pipe out, in; + out.create(); + if (!input.empty()) in.create(); /* Fork. */ Pid pid = startProcess([&]() { - if (dup2(stdout.writeSide, STDOUT_FILENO) == -1) + if (dup2(out.writeSide, STDOUT_FILENO) == -1) throw SysError("dupping stdout"); if (!input.empty()) { - if (dup2(stdin.readSide, STDIN_FILENO) == -1) + if (dup2(in.readSide, STDIN_FILENO) == -1) throw SysError("dupping stdin"); } @@ -967,16 +967,16 @@ string runProgram(Path program, bool searchPath, const Strings & args, throw SysError(format("executing ‘%1%’") % program); }); - stdout.writeSide.close(); + out.writeSide.close(); /* FIXME: This can deadlock if the input is too long. */ if (!input.empty()) { - stdin.readSide.close(); - writeFull(stdin.writeSide, input); - stdin.writeSide.close(); + in.readSide.close(); + writeFull(in.writeSide, input); + in.writeSide.close(); } - string result = drainFD(stdout.readSide); + string result = drainFD(out.readSide); /* Wait for the child to finish. */ int status = pid.wait(true); |