blob: 57849a4c7c0776eee7f93eba55fbc4a745f0ff78 [file] [log] [blame]
Karl Schimpfa667fb82014-05-19 14:56:51 -07001import subprocess
2import sys
3
4def 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