mirror of
https://github.com/privatevoid-net/nix-super.git
synced 2024-11-23 06:26:15 +02:00
util: rename stdout/stdin members to avoid conflicts w/standard macro
(cherry picked from commit c389a7fb617ed7bcd617efa68c6a48c00405310d)
This commit is contained in:
parent
ae299ab47a
commit
9b33201e72
2 changed files with 9 additions and 9 deletions
|
@ -931,7 +931,7 @@ std::pair<int, std::string> runProgram(const RunOptions & options_)
|
||||||
{
|
{
|
||||||
RunOptions options(options_);
|
RunOptions options(options_);
|
||||||
StringSink sink;
|
StringSink sink;
|
||||||
options.stdout = &sink;
|
options.standardOut = &sink;
|
||||||
|
|
||||||
int status = 0;
|
int status = 0;
|
||||||
|
|
||||||
|
@ -948,10 +948,10 @@ void runProgram2(const RunOptions & options)
|
||||||
{
|
{
|
||||||
checkInterrupt();
|
checkInterrupt();
|
||||||
|
|
||||||
assert(!(options.stdin && options.input));
|
assert(!(options.standardIn && options.input));
|
||||||
|
|
||||||
std::unique_ptr<Source> source_;
|
std::unique_ptr<Source> source_;
|
||||||
Source * source = options.stdin;
|
Source * source = options.standardIn;
|
||||||
|
|
||||||
if (options.input) {
|
if (options.input) {
|
||||||
source_ = std::make_unique<StringSource>(*options.input);
|
source_ = std::make_unique<StringSource>(*options.input);
|
||||||
|
@ -960,12 +960,12 @@ void runProgram2(const RunOptions & options)
|
||||||
|
|
||||||
/* Create a pipe. */
|
/* Create a pipe. */
|
||||||
Pipe out, in;
|
Pipe out, in;
|
||||||
if (options.stdout) out.create();
|
if (options.standardOut) out.create();
|
||||||
if (source) in.create();
|
if (source) in.create();
|
||||||
|
|
||||||
/* Fork. */
|
/* Fork. */
|
||||||
Pid pid = startProcess([&]() {
|
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");
|
throw SysError("dupping stdout");
|
||||||
if (source && dup2(in.readSide.get(), STDIN_FILENO) == -1)
|
if (source && dup2(in.readSide.get(), STDIN_FILENO) == -1)
|
||||||
throw SysError("dupping stdin");
|
throw SysError("dupping stdin");
|
||||||
|
@ -1017,8 +1017,8 @@ void runProgram2(const RunOptions & options)
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
if (options.stdout)
|
if (options.standardOut)
|
||||||
drainFD(out.readSide.get(), *options.stdout);
|
drainFD(out.readSide.get(), *options.standardOut);
|
||||||
|
|
||||||
/* Wait for the child to finish. */
|
/* Wait for the child to finish. */
|
||||||
int status = pid.wait();
|
int status = pid.wait();
|
||||||
|
|
|
@ -260,8 +260,8 @@ struct RunOptions
|
||||||
bool searchPath = true;
|
bool searchPath = true;
|
||||||
Strings args;
|
Strings args;
|
||||||
std::experimental::optional<std::string> input;
|
std::experimental::optional<std::string> input;
|
||||||
Source * stdin = nullptr;
|
Source * standardIn = nullptr;
|
||||||
Sink * stdout = nullptr;
|
Sink * standardOut = nullptr;
|
||||||
bool _killStderr = false;
|
bool _killStderr = false;
|
||||||
|
|
||||||
RunOptions(const Path & program, const Strings & args)
|
RunOptions(const Path & program, const Strings & args)
|
||||||
|
|
Loading…
Reference in a new issue