mirror of https://github.com/Icinga/icinga2.git
Use CompatUtility::GetCommandLine in StatusDataWriter::DumpCommand.
Fixes #5353
This commit is contained in:
parent
1bec9692c6
commit
ad563cf5d2
|
@ -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";
|
||||
|
|
|
@ -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 */
|
||||
|
|
Loading…
Reference in New Issue