aboutsummaryrefslogtreecommitdiff
path: root/music_sampler/actions/run_command.py
blob: 1e80c1eeb31f2dc6ae41b00192c879abdb36465e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
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