Skip to content

Commit

Permalink
#46 - fix run() on Windows environment
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
kensoh committed Aug 20, 2019
1 parent 34e44c8 commit 4737f5f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='tagui',
version='1.9.1',
version='1.10.0',
py_modules=['tagui'],
author='Ken Soh',
author_email='[email protected]',
Expand Down
8 changes: 6 additions & 2 deletions tagui.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""INTEGRATION ENGINE FOR TAGUI PYTHON PACKAGE ~ TEBEL.ORG"""
__author__ = 'Ken Soh <[email protected]>'
__version__ = '1.9.1'
__version__ = '1.10.0'

import subprocess
import os
Expand Down Expand Up @@ -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))

Expand Down

0 comments on commit 4737f5f

Please sign in to comment.