diff options
Diffstat (limited to 'music_sampler/actions/run_command.py')
-rw-r--r-- | music_sampler/actions/run_command.py | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/music_sampler/actions/run_command.py b/music_sampler/actions/run_command.py new file mode 100644 index 0000000..1e80c1e --- /dev/null +++ b/music_sampler/actions/run_command.py | |||
@@ -0,0 +1,13 @@ | |||
1 | import shlex, subprocess | ||
2 | |||
3 | def run(action, command="", wait=False, **kwargs): | ||
4 | action.process = subprocess.Popen(command, shell=True) | ||
5 | if wait: | ||
6 | action.process.wait() | ||
7 | |||
8 | def description(action, command="", wait=False, **kwargs): | ||
9 | message = "running command {}".format(command) | ||
10 | if wait: | ||
11 | message += " (waiting for its execution to finish)" | ||
12 | |||
13 | return message | ||