mirror of
https://github.com/Icinga/icinga2.git
synced 2025-06-03 21:30:18 +02:00
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 << command->GetName() << "\n";
|
||||||
|
|
||||||
fp << "\t" "command_line\t";
|
fp << "\t" "command_line" "\t" << CompatUtility::GetCommandLine(command);
|
||||||
|
|
||||||
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 << "\n" "\t" "}" "\n"
|
fp << "\n" "\t" "}" "\n"
|
||||||
"\n";
|
"\n";
|
||||||
|
@ -39,7 +39,7 @@ String CompatUtility::GetCommandLine(const Command::Ptr& command)
|
|||||||
{
|
{
|
||||||
Value commandLine = command->GetCommandLine();
|
Value commandLine = command->GetCommandLine();
|
||||||
|
|
||||||
String commandline;
|
String result;
|
||||||
if (commandLine.IsObjectType<Array>()) {
|
if (commandLine.IsObjectType<Array>()) {
|
||||||
Array::Ptr args = commandLine;
|
Array::Ptr args = commandLine;
|
||||||
|
|
||||||
@ -47,15 +47,15 @@ String CompatUtility::GetCommandLine(const Command::Ptr& command)
|
|||||||
String arg;
|
String arg;
|
||||||
BOOST_FOREACH(arg, args) {
|
BOOST_FOREACH(arg, args) {
|
||||||
// This is obviously incorrect for non-trivial cases.
|
// This is obviously incorrect for non-trivial cases.
|
||||||
commandline = " \"" + EscapeString(arg) + "\"";
|
result += " \"" + EscapeString(arg) + "\"";
|
||||||
}
|
}
|
||||||
} else if (!commandLine.IsEmpty()) {
|
} else if (!commandLine.IsEmpty()) {
|
||||||
commandline = EscapeString(Convert::ToString(commandLine));
|
result = EscapeString(Convert::ToString(commandLine));
|
||||||
} else {
|
} else {
|
||||||
commandline = "<internal>";
|
result = "<internal>";
|
||||||
}
|
}
|
||||||
|
|
||||||
return commandline;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* host */
|
/* host */
|
||||||
|
Loading…
x
Reference in New Issue
Block a user