From 000de699e9fd2a64ab748fc9a5103e9ecfcea4a5 Mon Sep 17 00:00:00 2001 From: Rok Garbas Date: Wed, 13 May 2015 09:37:12 +0200 Subject: [PATCH 1/2] cygwin: explicitly include required c headers --- src/libstore/build.cc | 1 + src/libstore/local-store.cc | 1 + 2 files changed, 2 insertions(+) diff --git a/src/libstore/build.cc b/src/libstore/build.cc index 2d81f72c1..50c59c131 100644 --- a/src/libstore/build.cc +++ b/src/libstore/build.cc @@ -20,6 +20,7 @@ #include #include #include +#include #include #include #include diff --git a/src/libstore/local-store.cc b/src/libstore/local-store.cc index 91149b30f..1dcd7228f 100644 --- a/src/libstore/local-store.cc +++ b/src/libstore/local-store.cc @@ -13,6 +13,7 @@ #include #include +#include #include #include #include From dad754843aad61ea4e92e4c3111ca432de4511f5 Mon Sep 17 00:00:00 2001 From: Rok Garbas Date: Wed, 13 May 2015 09:37:56 +0200 Subject: [PATCH 2/2] cygwin: looks like stdout/stdin are reserved words --- src/libutil/util.cc | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/libutil/util.cc b/src/libutil/util.cc index ab0a3b303..5cda9a067 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);