aboutsummaryrefslogtreecommitdiffstats
path: root/util
diff options
context:
space:
mode:
authorstakanviski <stakanviski@yandex-team.ru>2022-02-10 16:50:01 +0300
committerDaniil Cherednik <dcherednik@yandex-team.ru>2022-02-10 16:50:01 +0300
commit95ab23a39b5482a434361566cabdd5b0a433cb43 (patch)
tree5d5cb817648f650d76cf1076100726fd9b8448e8 /util
parentda8356a5535e6177965cba3bbae73c5fb28f6ccc (diff)
downloadydb-95ab23a39b5482a434361566cabdd5b0a433cb43.tar.gz
Restoring authorship annotation for <stakanviski@yandex-team.ru>. Commit 2 of 2.
Diffstat (limited to 'util')
-rw-r--r--util/random/random.cpp2
-rw-r--r--util/system/shellcommand.cpp22
-rw-r--r--util/system/shellcommand.h36
-rw-r--r--util/system/shellcommand_ut.cpp30
4 files changed, 45 insertions, 45 deletions
diff --git a/util/random/random.cpp b/util/random/random.cpp
index 3af891aab7..71f9323856 100644
--- a/util/random/random.cpp
+++ b/util/random/random.cpp
@@ -49,7 +49,7 @@ namespace {
template <class T>
static inline TRndGen<T>* GetRndGen() {
- return FastTlsSingletonWithPriority<TRndGen<T>, 2>();
+ return FastTlsSingletonWithPriority<TRndGen<T>, 2>();
}
template <unsigned N>
diff --git a/util/system/shellcommand.cpp b/util/system/shellcommand.cpp
index 35aa721657..b1989b5c8c 100644
--- a/util/system/shellcommand.cpp
+++ b/util/system/shellcommand.cpp
@@ -299,7 +299,7 @@ public:
, QuoteArguments(options.QuoteArguments)
, DetachSession(options.DetachSession)
, CloseStreams(options.CloseStreams)
- , ShouldCloseInput(options.ShouldCloseInput)
+ , ShouldCloseInput(options.ShouldCloseInput)
, InputMode(options.InputMode)
, OutputMode(options.OutputMode)
, ErrorMode(options.ErrorMode)
@@ -414,10 +414,10 @@ public:
}
}
- inline void CloseInput() {
+ inline void CloseInput() {
AtomicSet(ShouldCloseInput, true);
- }
-
+ }
+
inline static bool TerminateIsRequired(void* processInfo) {
TProcessInfo* pi = reinterpret_cast<TProcessInfo*>(processInfo);
if (!pi->Parent->TerminateFlag) {
@@ -1036,8 +1036,8 @@ void TShellCommand::TImpl::Communicate(TProcessInfo* pi) {
bytesToWrite = input->Read(inputBuffer.Data(), inputBuffer.Capacity());
if (bytesToWrite == 0) {
if (AtomicGet(pi->Parent->ShouldCloseInput)) {
- input = nullptr;
- }
+ input = nullptr;
+ }
continue;
}
bufPos = inputBuffer.Data();
@@ -1189,11 +1189,11 @@ TShellCommand& TShellCommand::Wait() {
Impl->Wait();
return *this;
}
-
-TShellCommand& TShellCommand::CloseInput() {
- Impl->CloseInput();
- return *this;
-}
+
+TShellCommand& TShellCommand::CloseInput() {
+ Impl->CloseInput();
+ return *this;
+}
TString TShellCommand::GetQuotedCommand() const {
return Impl->GetQuotedCommand();
diff --git a/util/system/shellcommand.h b/util/system/shellcommand.h
index ff0f2d043c..8730627fe5 100644
--- a/util/system/shellcommand.h
+++ b/util/system/shellcommand.h
@@ -179,17 +179,17 @@ public:
}
/**
- * @brief set if input stream should be closed after all data is read
- * call SetCloseInput(false) for interactive process
- * @param val if input stream should be closed
- * @return self
- */
- inline TShellCommandOptions& SetCloseInput(bool val) {
- ShouldCloseInput = val;
- return *this;
- }
-
- /**
+ * @brief set if input stream should be closed after all data is read
+ * call SetCloseInput(false) for interactive process
+ * @param val if input stream should be closed
+ * @return self
+ */
+ inline TShellCommandOptions& SetCloseInput(bool val) {
+ ShouldCloseInput = val;
+ return *this;
+ }
+
+ /**
* @brief set if command should be interpreted by OS shell (/bin/sh or cmd.exe)
* shell is enabled by default
* call SetUseShell(false) for command to be sent to OS verbatim
@@ -457,13 +457,13 @@ public:
*/
TShellCommand& Wait();
- /**
- * @brief close process' stdin
- *
- * @return self
- */
- TShellCommand& CloseInput();
-
+ /**
+ * @brief close process' stdin
+ *
+ * @return self
+ */
+ TShellCommand& CloseInput();
+
/**
* @brief Get quoted command (for debug/view purposes only!)
**/
diff --git a/util/system/shellcommand_ut.cpp b/util/system/shellcommand_ut.cpp
index bfe81c8654..9d849279d2 100644
--- a/util/system/shellcommand_ut.cpp
+++ b/util/system/shellcommand_ut.cpp
@@ -226,32 +226,32 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) {
Y_UNIT_TEST(TestIO) {
// descriptive test: use all options
TShellCommandOptions options;
- options.SetAsync(true);
+ options.SetAsync(true);
options.SetQuoteArguments(false);
options.SetLatency(10);
options.SetClearSignalMask(true);
options.SetCloseAllFdsOnExec(true);
- options.SetCloseInput(false);
+ options.SetCloseInput(false);
TGuardedStringStream write;
options.SetInputStream(&write);
TGuardedStringStream read;
options.SetOutputStream(&read);
options.SetUseShell(true);
- TShellCommand cmd("cat", options);
+ TShellCommand cmd("cat", options);
cmd.Run();
-
- write << "alpha" << NL;
- while (read.Str() != "alpha" NL) {
- Sleep(TDuration::MilliSeconds(10));
- }
-
- write << "omega" << NL;
- while (read.Str() != "alpha" NL "omega" NL) {
- Sleep(TDuration::MilliSeconds(10));
- }
-
- write << "zeta" << NL;
+
+ write << "alpha" << NL;
+ while (read.Str() != "alpha" NL) {
+ Sleep(TDuration::MilliSeconds(10));
+ }
+
+ write << "omega" << NL;
+ while (read.Str() != "alpha" NL "omega" NL) {
+ Sleep(TDuration::MilliSeconds(10));
+ }
+
+ write << "zeta" << NL;
cmd.CloseInput();
cmd.Wait();