Avoid stdout/stderr as variable names
This commit is contained in:
parent
09e2a0b6ac
commit
2be6cc918b
|
@ -47,7 +47,7 @@ std::pair<String, int> ShellManager::eval(
|
||||||
write(write_pipe[1], input.data(), (int)input.length());
|
write(write_pipe[1], input.data(), (int)input.length());
|
||||||
close(write_pipe[1]);
|
close(write_pipe[1]);
|
||||||
|
|
||||||
String stdout, stderr;
|
String child_stdout, child_stderr;
|
||||||
{
|
{
|
||||||
auto pipe_reader = [](String& output) {
|
auto pipe_reader = [](String& output) {
|
||||||
return [&output](FDWatcher& watcher, EventMode) {
|
return [&output](FDWatcher& watcher, EventMode) {
|
||||||
|
@ -59,19 +59,19 @@ std::pair<String, int> ShellManager::eval(
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
FDWatcher stdout_watcher{read_pipe[0], pipe_reader(stdout)};
|
FDWatcher stdout_watcher{read_pipe[0], pipe_reader(child_stdout)};
|
||||||
FDWatcher stderr_watcher{error_pipe[0], pipe_reader(stderr)};
|
FDWatcher stderr_watcher{error_pipe[0], pipe_reader(child_stderr)};
|
||||||
|
|
||||||
while (not stdout_watcher.closed() or not stderr_watcher.closed())
|
while (not stdout_watcher.closed() or not stderr_watcher.closed())
|
||||||
EventManager::instance().handle_next_events(EventMode::Urgent);
|
EventManager::instance().handle_next_events(EventMode::Urgent);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (not stderr.empty())
|
if (not child_stderr.empty())
|
||||||
write_debug("shell stderr: <<<\n" + stderr + ">>>");
|
write_debug("shell stderr: <<<\n" + child_stderr + ">>>");
|
||||||
|
|
||||||
int status = 0;
|
int status = 0;
|
||||||
waitpid(pid, &status, 0);
|
waitpid(pid, &status, 0);
|
||||||
return { stdout, WIFEXITED(status) ? WEXITSTATUS(status) : - 1 };
|
return { child_stdout, WIFEXITED(status) ? WEXITSTATUS(status) : - 1 };
|
||||||
}
|
}
|
||||||
else try
|
else try
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user