From 96878a218c1435911233ab9b5b42efe8d0a88db8 Mon Sep 17 00:00:00 2001 From: "maruel@chromium.org" Date: Thu, 10 Jun 2010 18:26:33 +0000 Subject: Changed the position of the output->swap() call. This way, even if the command encounters an error, we still record the output. This is important for the case when stderr has been redirected to stdout, and we'd like to see stdout even when the exit code is non-zero. Patch contributed by Michael Williamson. Review URL: http://codereview.chromium.org/2665004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@49423 0039d316-1c4b-4281-b951-d872f2087c98 --- base/process_util_unittest.cc | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'base/process_util_unittest.cc') diff --git a/base/process_util_unittest.cc b/base/process_util_unittest.cc index 96dca2f..15405f4 100644 --- a/base/process_util_unittest.cc +++ b/base/process_util_unittest.cc @@ -459,12 +459,11 @@ TEST_F(ProcessUtilTest, GetAppOutputRestricted) { EXPECT_TRUE(base::GetAppOutputRestricted(CommandLine(argv), &output, 100)); EXPECT_STREQ("", output.c_str()); - // On failure, should not touch |output|. As above, but for |false|. argv[2] = "exit 1"; // equivalent to "false" - output = "abc"; + output = "before"; EXPECT_FALSE(base::GetAppOutputRestricted(CommandLine(argv), - &output, 100)); - EXPECT_STREQ("abc", output.c_str()); + &output, 100)); + EXPECT_STREQ("", output.c_str()); // Amount of output exactly equal to space allowed. argv[2] = "echo 123456789"; // (the sh built-in doesn't take "-n") -- cgit v1.1