diff options
author | Shea Levy <shea@shealevy.com> | 2018-03-19T17·14-0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-19T17·14-0600 |
commit | d53970d31bdf9e4133a6ddd42d6a8d6db15903c4 (patch) | |
tree | 79fa29810e7a31a5b3203136a69fee2c32c7bf32 | |
parent | ae299ab47a6170fb880f962c256991a9a205ceaf (diff) | |
parent | 9b33201e727b8c1ac0eef08624ebff5b60c9ffd7 (diff) |
Merge pull request #1989 from dtzWill/fix/avoid-reserved-standard-macros
util: rename stdout/stdin members to avoid conflicts w/standard macro
-rw-r--r-- | src/libutil/util.cc | 14 | ||||
-rw-r--r-- | src/libutil/util.hh | 4 |
2 files changed, 9 insertions, 9 deletions
diff --git a/src/libutil/util.cc b/src/libutil/util.cc index 37a35ab233bd..764b4e44207e 100644 --- a/src/libutil/util.cc +++ b/src/libutil/util.cc @@ -931,7 +931,7 @@ std::pair<int, std::string> runProgram(const RunOptions & options_) { RunOptions options(options_); StringSink sink; - options.stdout = &sink; + options.standardOut = &sink; int status = 0; @@ -948,10 +948,10 @@ void runProgram2(const RunOptions & options) { checkInterrupt(); - assert(!(options.stdin && options.input)); + assert(!(options.standardIn && options.input)); std::unique_ptr<Source> source_; - Source * source = options.stdin; + Source * source = options.standardIn; if (options.input) { source_ = std::make_unique<StringSource>(*options.input); @@ -960,12 +960,12 @@ void runProgram2(const RunOptions & options) /* Create a pipe. */ Pipe out, in; - if (options.stdout) out.create(); + if (options.standardOut) out.create(); if (source) in.create(); /* Fork. */ Pid pid = startProcess([&]() { - if (options.stdout && dup2(out.writeSide.get(), STDOUT_FILENO) == -1) + if (options.standardOut && dup2(out.writeSide.get(), STDOUT_FILENO) == -1) throw SysError("dupping stdout"); if (source && dup2(in.readSide.get(), STDIN_FILENO) == -1) throw SysError("dupping stdin"); @@ -1017,8 +1017,8 @@ void runProgram2(const RunOptions & options) }); } - if (options.stdout) - drainFD(out.readSide.get(), *options.stdout); + if (options.standardOut) + drainFD(out.readSide.get(), *options.standardOut); /* Wait for the child to finish. */ int status = pid.wait(); diff --git a/src/libutil/util.hh b/src/libutil/util.hh index 1ea1027ac0ac..85952535db29 100644 --- a/src/libutil/util.hh +++ b/src/libutil/util.hh @@ -260,8 +260,8 @@ struct RunOptions bool searchPath = true; Strings args; std::experimental::optional<std::string> input; - Source * stdin = nullptr; - Sink * stdout = nullptr; + Source * standardIn = nullptr; + Sink * standardOut = nullptr; bool _killStderr = false; RunOptions(const Path & program, const Strings & args) |