[libFuzzer] Make redirects happen in proper sequence.

"> file" must come before "2>&1" to have redirection occur correctly in
all cases.  Fixes a regression on minimize_two_crashes.test.

llvm-svn: 319792
This commit is contained in:
Matt Morehouse 2017-12-05 17:13:17 +00:00
parent df6ba242bf
commit 056774d13b
2 changed files with 3 additions and 3 deletions

View File

@ -143,10 +143,10 @@ public:
std::stringstream SS;
for (auto arg : getArguments())
SS << arg << " ";
if (isOutAndErrCombined())
SS << "2>&1 ";
if (hasOutputFile())
SS << ">" << getOutputFile() << " ";
if (isOutAndErrCombined())
SS << "2>&1 ";
std::string result = SS.str();
if (!result.empty())
result = result.substr(0, result.length() - 1);

View File

@ -923,7 +923,7 @@ TEST(FuzzerCommand, SetOutput) {
EXPECT_TRUE(Cmd.isOutAndErrCombined());
CmdLine = Cmd.toString();
EXPECT_EQ(CmdLine, makeCmdLine("", "2>&1 >thud"));
EXPECT_EQ(CmdLine, makeCmdLine("", ">thud 2>&1"));
}
int main(int argc, char **argv) {