diff --git a/param/version.py b/param/version.py index 9884491e..ed863740 100644 --- a/param/version.py +++ b/param/version.py @@ -21,10 +21,13 @@ import os, subprocess, json def run_cmd(args, cwd=None): + kwargs = {} + if os.name == 'nt': + kwargs['creationflags'] = subprocess.CREATE_NO_WINDOW proc = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd, - creationflags=subprocess.CREATE_NO_WINDOW) + **kwargs) output, error = (str(s.decode()).strip() for s in proc.communicate()) # Detects errors as _either_ a non-zero return code _or_ messages diff --git a/tests/testversion.py b/tests/testversion.py new file mode 100644 index 00000000..1a71f673 --- /dev/null +++ b/tests/testversion.py @@ -0,0 +1,6 @@ +from param.version import run_cmd + + +def test_run_cmd(): + output = run_cmd(['echo', 'test']) + assert output == 'test'