blob: 32a4ee1b8b319162e4a51a4a6a24bfd429c23b39 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
import click
import subprocess
"""
API for interacting with the system shell
"""
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)))
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))
|