From df9ddd346b801ed4f69b0637eb82124accef9ada Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Isma=C3=ABl=20Bouya?= Date: Wed, 27 Jul 2016 10:10:30 +0200 Subject: Add 'run_command' action --- helpers/actions/run_command.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 helpers/actions/run_command.py (limited to 'helpers/actions/run_command.py') diff --git a/helpers/actions/run_command.py b/helpers/actions/run_command.py new file mode 100644 index 0000000..1e80c1e --- /dev/null +++ b/helpers/actions/run_command.py @@ -0,0 +1,13 @@ +import shlex, subprocess + +def run(action, command="", wait=False, **kwargs): + action.process = subprocess.Popen(command, shell=True) + if wait: + action.process.wait() + +def description(action, command="", wait=False, **kwargs): + message = "running command {}".format(command) + if wait: + message += " (waiting for its execution to finish)" + + return message -- cgit v1.2.3