diff options
-rw-r--r-- | src/linux/ogOperations.py | 2 | ||||
-rw-r--r-- | src/ogRest.py | 2 | ||||
-rw-r--r-- | tests/units/test_0003_shellrun.py | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/src/linux/ogOperations.py b/src/linux/ogOperations.py index 505894b..357dd2f 100644 --- a/src/linux/ogOperations.py +++ b/src/linux/ogOperations.py @@ -49,7 +49,7 @@ def reboot(): def execCMD(request, ogRest): cmd = request.getrun() - cmds = cmd.split(" ") + cmds = cmd.split(";|\n") try: ogRest.proc = subprocess.Popen(cmds, stdout=subprocess.PIPE, shell=True) (output, error) = ogRest.proc.communicate() diff --git a/src/ogRest.py b/src/ogRest.py index 781fb80..f46a331 100644 --- a/src/ogRest.py +++ b/src/ogRest.py @@ -62,7 +62,7 @@ class restResponse(): class ogThread(): def execcmd(client, request, ogRest): - if request.getrun() == None: + if not request.getrun(): response = restResponse(ogResponses.BAD_REQUEST) client.send(response.get()) return diff --git a/tests/units/test_0003_shellrun.py b/tests/units/test_0003_shellrun.py index ada1795..79b7305 100644 --- a/tests/units/test_0003_shellrun.py +++ b/tests/units/test_0003_shellrun.py @@ -14,7 +14,7 @@ class TestShellRunMethods(unittest.TestCase): def test_post_with_echo(self): req_json = '{"run":"echo \\"croqueta\\"", "echo":true}' - response_json = '{"out": "\\"croqueta\\"\\n"}' + response_json = '{"out": \"croqueta\\n\"}' req = 'POST /shell/run HTTP/1.0\r\nContent-Length:'+ \ str(len(req_json)) + \ '\r\nContent-Type:application/json\r\n\r\n' + req_json |