Use CompatUtility::GetCommandLine in StatusDataWriter::DumpCommand.

Fixes #5353
This commit is contained in:
Gunnar Beutner 2013-12-17 10:20:28 +01:00
parent 1bec9692c6
commit ad563cf5d2
2 changed files with 6 additions and 23 deletions

View File

@ -134,24 +134,7 @@ void StatusDataWriter::DumpCommand(std::ostream& fp, const Command::Ptr& command
fp << command->GetName() << "\n";
fp << "\t" "command_line\t";
Value commandLine = command->GetCommandLine();
if (commandLine.IsObjectType<Array>()) {
Array::Ptr args = commandLine;
ObjectLock olock(args);
String arg;
BOOST_FOREACH(arg, args) {
// This is obviously incorrect for non-trivial cases.
fp << " \"" << CompatUtility::EscapeString(arg) << "\"";
}
} else if (!commandLine.IsEmpty()) {
fp << CompatUtility::EscapeString(commandLine);
} else {
fp << "<internal>";
}
fp << "\t" "command_line" "\t" << CompatUtility::GetCommandLine(command);
fp << "\n" "\t" "}" "\n"
"\n";

View File

@ -39,7 +39,7 @@ String CompatUtility::GetCommandLine(const Command::Ptr& command)
{
Value commandLine = command->GetCommandLine();
String commandline;
String result;
if (commandLine.IsObjectType<Array>()) {
Array::Ptr args = commandLine;
@ -47,15 +47,15 @@ String CompatUtility::GetCommandLine(const Command::Ptr& command)
String arg;
BOOST_FOREACH(arg, args) {
// This is obviously incorrect for non-trivial cases.
commandline = " \"" + EscapeString(arg) + "\"";
result += " \"" + EscapeString(arg) + "\"";
}
} else if (!commandLine.IsEmpty()) {
commandline = EscapeString(Convert::ToString(commandLine));
result = EscapeString(Convert::ToString(commandLine));
} else {
commandline = "<internal>";
result = "<internal>";
}
return commandline;
return result;
}
/* host */