diff options
Diffstat (limited to 'util/system/shellcommand_ut.cpp')
-rw-r--r-- | util/system/shellcommand_ut.cpp | 58 |
1 files changed, 29 insertions, 29 deletions
diff --git a/util/system/shellcommand_ut.cpp b/util/system/shellcommand_ut.cpp index 9d849279d2..88caf51d45 100644 --- a/util/system/shellcommand_ut.cpp +++ b/util/system/shellcommand_ut.cpp @@ -436,35 +436,35 @@ Y_UNIT_TEST_SUITE(TShellCommandTest) { UNIT_ASSERT_VALUES_EQUAL(cmd.GetOutput(), "hello" NL); UNIT_ASSERT_VALUES_EQUAL(cmd.GetError().size(), 0u); } - Y_UNIT_TEST(TestPipeOutput) { - TShellCommandOptions options; - options.SetAsync(true); - options.PipeOutput(); - constexpr TStringBuf firstMessage = "first message"; - constexpr TStringBuf secondMessage = "second message"; - const TString command = TStringBuilder() << "echo '" << firstMessage << "' && sleep 10 && echo '" << secondMessage << "'"; - TShellCommand cmd(command, options); - cmd.Run(); - TUnbufferedFileInput cmdOutput(TFile(cmd.GetOutputHandle().Release())); - TString firstLineOutput, secondLineOutput; - { - Sleep(TDuration::Seconds(5)); - firstLineOutput = cmdOutput.ReadLine(); - cmd.Wait(); - secondLineOutput = cmdOutput.ReadLine(); - } - UNIT_ASSERT_VALUES_EQUAL(firstLineOutput, firstMessage); - UNIT_ASSERT_VALUES_EQUAL(secondLineOutput, secondLineOutput); - } - Y_UNIT_TEST(TestOptionsConsistency) { - TShellCommandOptions options; - - options.SetInheritOutput(false).SetInheritError(false); - options.SetOutputStream(nullptr).SetErrorStream(nullptr); - - UNIT_ASSERT(options.OutputMode == TShellCommandOptions::HANDLE_STREAM); - UNIT_ASSERT(options.ErrorMode == TShellCommandOptions::HANDLE_STREAM); - } + Y_UNIT_TEST(TestPipeOutput) { + TShellCommandOptions options; + options.SetAsync(true); + options.PipeOutput(); + constexpr TStringBuf firstMessage = "first message"; + constexpr TStringBuf secondMessage = "second message"; + const TString command = TStringBuilder() << "echo '" << firstMessage << "' && sleep 10 && echo '" << secondMessage << "'"; + TShellCommand cmd(command, options); + cmd.Run(); + TUnbufferedFileInput cmdOutput(TFile(cmd.GetOutputHandle().Release())); + TString firstLineOutput, secondLineOutput; + { + Sleep(TDuration::Seconds(5)); + firstLineOutput = cmdOutput.ReadLine(); + cmd.Wait(); + secondLineOutput = cmdOutput.ReadLine(); + } + UNIT_ASSERT_VALUES_EQUAL(firstLineOutput, firstMessage); + UNIT_ASSERT_VALUES_EQUAL(secondLineOutput, secondLineOutput); + } + Y_UNIT_TEST(TestOptionsConsistency) { + TShellCommandOptions options; + + options.SetInheritOutput(false).SetInheritError(false); + options.SetOutputStream(nullptr).SetErrorStream(nullptr); + + UNIT_ASSERT(options.OutputMode == TShellCommandOptions::HANDLE_STREAM); + UNIT_ASSERT(options.ErrorMode == TShellCommandOptions::HANDLE_STREAM); + } Y_UNIT_TEST(TestForkCallback) { TString tmpFile = TString("shellcommand_ut.test_for_callback.txt"); TFsPath cwd(::NFs::CurrentWorkingDirectory()); |