refactorred stdout piping a bit to allow manual piping

This commit is contained in:
Edwin Eefting
2022-01-27 13:02:41 +01:00
parent f2761ecee8
commit 609ad19dd9
4 changed files with 87 additions and 60 deletions

View File

@ -156,16 +156,16 @@ class TestExecuteNode(unittest2.TestCase):
self.assertEqual(nodeb.run(cmd=["pwd", ExecuteNode.PIPE, "cat"], cwd="/tmp/space test"), ["/tmp/space test"])
self.assertEqual(nodeb.run(cmd=["cat", ExecuteNode.PIPE, "pwd"], cwd="/tmp/space test"), ["/tmp/space test"])
def test_script(self):
def stdout_handler(line):
print("handle: " + line)
nodea=ExecuteNode(debug_output=True, ssh_to="localhost")
cmd_pipe=nodea.script(lines=["echo line1", "echo line 2"])
cmd_pipe.execute(stdout_handler)
# #
# def test_script(self):
#
# def stdout_handler(line):
# print("handle: " + line)
#
# nodea=ExecuteNode(debug_output=True, ssh_to="localhost")
#
# cmd_pipe=nodea.script(lines=["echo line1", "echo line 2"])
# cmd_pipe.execute(stdout_handler)