aboutsummaryrefslogtreecommitdiffstats
path: root/qface/shell.py
diff options
context:
space:
mode:
authorJuergen Bocklage-Ryannel <juergen@ryannel.org>2018-12-24 15:46:42 +0100
committerDominik Holland <dominik.holland@googlemail.com>2022-01-27 13:50:04 +0100
commit031743b53259dd73b611cd9965d392558e76a79c (patch)
tree6a1664759516b3fdc02894e20f966281f1a2d45c /qface/shell.py
parentca2868a450c4090d5460827a896648280bb72eb0 (diff)
add run option to qface script
Diffstat (limited to 'qface/shell.py')
-rw-r--r--qface/shell.py11
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))