diff options
Diffstat (limited to 'qface/shell.py')
-rw-r--r-- | qface/shell.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/qface/shell.py b/qface/shell.py index bf76f7c..32a4ee1 100644 --- a/qface/shell.py +++ b/qface/shell.py @@ -1,5 +1,5 @@ import click -from subprocess import call +import subprocess """ API for interacting with the system shell @@ -10,7 +10,14 @@ def sh(args, **kwargs): """ runs the given cmd as shell command """ + if isinstance(args, str): + args = args.split() if not args: return click.echo('$ {0}'.format(' '.join(args))) - return call(args, **kwargs) + try: + return subprocess.check_call(args, **kwargs) + except subprocess.CalledProcessError as exc: + click.secho('run error {}'.format(exc)) + except OSError as exc: + click.secho('not found error {}'.format(exc)) |