Echo a command before running it. Defaults to repo as cwd
(cmd, **kwargs)
| 208 | |
| 209 | |
| 210 | def run(cmd, **kwargs): |
| 211 | """Echo a command before running it. Defaults to repo as cwd""" |
| 212 | log.info('> ' + list2cmdline(cmd)) |
| 213 | kwargs.setdefault('cwd', HERE) |
| 214 | kwargs.setdefault('shell', os.name == 'nt') |
| 215 | if not isinstance(cmd, (list, tuple)) and os.name != 'nt': |
| 216 | cmd = shlex.split(cmd) |
| 217 | cmd_path = which(cmd[0]) |
| 218 | if not cmd_path: |
| 219 | sys.exit("Aborting. Could not find cmd (%s) in path. " |
| 220 | "If command is not expected to be in user's path, " |
| 221 | "use an absolute path." % cmd[0]) |
| 222 | cmd[0] = cmd_path |
| 223 | return subprocess.check_call(cmd, **kwargs) |
| 224 | |
| 225 | |
| 226 | def is_stale(target, source): |
no test coverage detected