Allow pipes in sh commands
authorEduardo Ramos Testillano <eduardo.ramos.testillano@ericsson.com>
Thu, 10 Dec 2015 17:17:58 +0000 (18:17 +0100)
committerEduardo Ramos Testillano <eduardo.ramos.testillano@ericsson.com>
Thu, 10 Dec 2015 17:17:58 +0000 (18:17 +0100)
example/diameter/launcher/Launcher.cpp

index 120fabc..0faafe2 100644 (file)
@@ -2079,10 +2079,13 @@ void Launcher::eventOperation(const std::string &operation, std::string &respons
         }
       }
       else if (param2 == "sh-command") {
-        if (numParams > 4)
-          throw anna::RuntimeException("Wrong body content format on HTTP Request. Use 'help' management command to see more information.", ANNA_FILE_LOCATION);
+        // Allow pipes in command:
+        //if (numParams > 4)
+        //  throw anna::RuntimeException("Wrong body content format on HTTP Request. Use 'help' management command to see more information.", ANNA_FILE_LOCATION);
         if(param3 == "") throw anna::RuntimeException("Missing script/executable command-line for 'sh-command' in test id operation", ANNA_FILE_LOCATION);
-        testManager.getTestCase(id)->addCommand(param3); // creates / reuses
+        std::string token = "|sh-command|";
+        std::string command = operation.substr(operation.find(token) + token.size());
+        testManager.getTestCase(id)->addCommand(command); // creates / reuses
       }
       else {
         throw anna::RuntimeException("Wrong body content format on HTTP Request. Use 'help' management command to see more information.", ANNA_FILE_LOCATION);