From 4737f5f71de1350b34c127da644ff808b27a96b3 Mon Sep 17 00:00:00 2001 From: Ken Soh Date: Tue, 20 Aug 2019 10:43:50 +0800 Subject: [PATCH] #46 - fix run() on Windows environment The run() function does not work correctly on Windows. The root cause is semi-colon is not approrpriate as delimiter to combine with exit 0 command (for retrieving error output without triggering exception). This fix uses ; for Linux and macOS and & as the delimiter in Windows environment. More details in #46. --- README.md | 2 +- setup.py | 2 +- tagui.py | 8 ++++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 873929b..6761d7b 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ # TagUI for Python -[**Use Cases**](#use-cases) | [**API Reference**](#api-reference) | [**About & Credits**](#about--credits) | [**v1.9**](https://github.com/tebelorg/TagUI-Python/releases) +[**Use Cases**](#use-cases) | [**API Reference**](#api-reference) | [**About & Credits**](#about--credits) | [**v1.10**](https://github.com/tebelorg/TagUI-Python/releases) ![TagUI for Python demo in Jupyter notebook](https://raw.githubusercontent.com/tebelorg/Tump/master/tagui_python.gif) diff --git a/setup.py b/setup.py index a19b5c1..1dedd3f 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='tagui', - version='1.9.1', + version='1.10.0', py_modules=['tagui'], author='Ken Soh', author_email='opensource@tebel.org', diff --git a/tagui.py b/tagui.py index 942c0fe..443ebab 100644 --- a/tagui.py +++ b/tagui.py @@ -1,6 +1,6 @@ """INTEGRATION ENGINE FOR TAGUI PYTHON PACKAGE ~ TEBEL.ORG""" __author__ = 'Ken Soh ' -__version__ = '1.9.1' +__version__ = '1.10.0' import subprocess import os @@ -1167,8 +1167,12 @@ def run(command_to_run = None): return '' else: + if platform.system() == 'Windows': + command_delimiter = ' & ' + else: + command_delimiter = '; ' return _py23_decode(subprocess.check_output( - command_to_run + '; exit 0', + command_to_run + command_delimiter + 'exit 0', stderr=subprocess.STDOUT, shell=True))