Index: pydir/utils.py |
diff --git a/pydir/utils.py b/pydir/utils.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..57849a4c7c0776eee7f93eba55fbc4a745f0ff78 |
--- /dev/null |
+++ b/pydir/utils.py |
@@ -0,0 +1,12 @@ |
+import subprocess |
+import sys |
+ |
+def shellcmd(command, echo=True): |
+ if echo: print '[cmd]', command |
+ |
+ if not isinstance(command, str): |
+ command = ' '.join(command) |
+ |
+ stdout_result = subprocess.check_output(command, shell=True) |
+ if echo: sys.stdout.write(stdout_result) |
+ return stdout_result |