diff options
author | whcrc <whcrc@yandex-team.ru> | 2022-02-10 16:49:30 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:49:30 +0300 |
commit | c8684fa83d799b720b948c7df1a6dc98cb249651 (patch) | |
tree | 8f88503dba71a02a3a0e8ab5513c020ebfb37a7a /util/system/shellcommand.cpp | |
parent | 9d2a99f5085a7425ef22831762c8684b687e0500 (diff) | |
download | ydb-c8684fa83d799b720b948c7df1a6dc98cb249651.tar.gz |
Restoring authorship annotation for <whcrc@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'util/system/shellcommand.cpp')
-rw-r--r-- | util/system/shellcommand.cpp | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/util/system/shellcommand.cpp b/util/system/shellcommand.cpp index b1989b5c8c..d4c85f2b3d 100644 --- a/util/system/shellcommand.cpp +++ b/util/system/shellcommand.cpp @@ -1057,10 +1057,10 @@ void TShellCommand::TImpl::Communicate(TProcessInfo* pi) { } DBG(Cerr << "process finished" << Endl); - // What's the reason of process exit. - // We need to set exit code before waiting for input thread - // Otherwise there is no way for input stream provider to discover - // that process has exited and stream shouldn't wait for new data. + // What's the reason of process exit. + // We need to set exit code before waiting for input thread + // Otherwise there is no way for input stream provider to discover + // that process has exited and stream shouldn't wait for new data. bool cleanExit = false; TMaybe<int> processExitCode; #if defined(_unix_) @@ -1088,25 +1088,25 @@ void TShellCommand::TImpl::Communicate(TProcessInfo* pi) { } else { AtomicSet(pi->Parent->ExecutionStatus, SHELL_ERROR); } - -#if defined(_win_) - for (auto& threadHolder : streamThreads) - threadHolder->Join(); - for (const auto pump : pumps) { - if (!pump.InternalError.empty()) - throw yexception() << pump.InternalError; - } -#else - // Now let's read remaining stdout/stderr - while (output && (bytes = pi->OutputFd.Read(buffer.Data(), buffer.Capacity())) > 0) { - DBG(Cerr << bytes << " more bytes of output: " << Endl); - output->Write(buffer.Data(), bytes); - } - while (error && (bytes = pi->ErrorFd.Read(buffer.Data(), buffer.Capacity())) > 0) { - DBG(Cerr << bytes << " more bytes of error" << Endl); - error->Write(buffer.Data(), bytes); - } -#endif + +#if defined(_win_) + for (auto& threadHolder : streamThreads) + threadHolder->Join(); + for (const auto pump : pumps) { + if (!pump.InternalError.empty()) + throw yexception() << pump.InternalError; + } +#else + // Now let's read remaining stdout/stderr + while (output && (bytes = pi->OutputFd.Read(buffer.Data(), buffer.Capacity())) > 0) { + DBG(Cerr << bytes << " more bytes of output: " << Endl); + output->Write(buffer.Data(), bytes); + } + while (error && (bytes = pi->ErrorFd.Read(buffer.Data(), buffer.Capacity())) > 0) { + DBG(Cerr << bytes << " more bytes of error" << Endl); + error->Write(buffer.Data(), bytes); + } +#endif } catch (const yexception& e) { // Some error in watch occured, set result to error AtomicSet(pi->Parent->ExecutionStatus, SHELL_INTERNAL_ERROR); |