Karl Schimpf | a667fb8 | 2014-05-19 14:56:51 -0700 | [diff] [blame] | 1 | import subprocess |
2 | import sys | ||||
3 | |||||
4 | def shellcmd(command, echo=True): | ||||
5 | if echo: print '[cmd]', command | ||||
6 | |||||
7 | if not isinstance(command, str): | ||||
8 | command = ' '.join(command) | ||||
9 | |||||
10 | stdout_result = subprocess.check_output(command, shell=True) | ||||
11 | if echo: sys.stdout.write(stdout_result) | ||||
12 | return stdout_result |