MCPcopy Create free account
hub / github.com/SoarGroup/Soar / ExecuteCommandLine

Method ExecuteCommandLine

Core/ClientSML/src/sml_ClientKernel.cpp:1217–1251  ·  view source on GitHub ↗

* @brief Process a command line command * * @param pCommandLine Command line string to process. * @param pAgentName Agent name to apply the command line to (can be NULL) * @param echoResults If true the results are also echoed through the smlEVENT_ECHO event, so they can appear in a debugger (or other listener) * @param noFilter If true this command line by-passes any external filters that

Source from the content-addressed store, hash-verified

1215* @returns The string form of output from the command.
1216*************************************************************/
1217char const* Kernel::ExecuteCommandLine(char const* pCommandLine, char const* pAgentName, bool echoResults, bool noFilter)
1218{
1219 AnalyzeXML response;
1220 bool wantRawOutput = true ;
1221
1222 // Send the command line to the kernel
1223 m_CommandLineSucceeded = GetConnection()->SendAgentCommand(&response,
1224 sml_Names::kCommand_CommandLine, pAgentName,
1225 sml_Names::kParamLine, pCommandLine,
1226 sml_Names::kParamEcho, echoResults ? sml_Names::kTrue : sml_Names::kFalse,
1227 sml_Names::kParamNoFiltering, !m_FilteringEnabled || noFilter ? sml_Names::kTrue : sml_Names::kFalse,
1228 wantRawOutput);
1229
1230 if (m_CommandLineSucceeded)
1231 {
1232 // Get the result as a string
1233 char const* pResult = response.GetResultString();
1234 m_CommandLineResult = (pResult == NULL) ? "" : pResult ;
1235 }
1236 else
1237 {
1238 // Get the error message
1239 m_CommandLineResult = "Error: ";
1240 if (response.GetErrorTag())
1241 {
1242 m_CommandLineResult += response.GetErrorTag()->GetCharacterData();
1243 }
1244 else
1245 {
1246 m_CommandLineResult += "<No error message returned by command>";
1247 }
1248 }
1249
1250 return m_CommandLineResult.c_str();
1251}
1252
1253/*************************************************************
1254* @brief Execute a command line command and return the result

Callers

nothing calls this directly

Calls 5

SendAgentCommandMethod · 0.80
GetErrorTagMethod · 0.80
GetConnectionFunction · 0.70
GetResultStringMethod · 0.45
GetCharacterDataMethod · 0.45

Tested by

no test coverage detected