diff --git a/HISTORY.rst b/HISTORY.rst index a1b6d17..7bf55ab 100644 --- a/HISTORY.rst +++ b/HISTORY.rst @@ -1,6 +1,16 @@ ======= History ======= + +0.7.0 (2018-05-13) +------------------ + +* Unicode fixes. Fix crash on invalid UTF-8 input. +* Clarify that stdout/stderr values are returned as bytestrings. +* Callbacks receive the data decoded as UTF-8 unicode strings + with unknown characters replaced by \ufffd (unicode replacement + character). Same applies to printing of output. +* Mark stdin broken on Windows. 0.6.1 (2018-05-02) ------------------ diff --git a/README.rst b/README.rst index 3c5b0b4..d009e00 100644 --- a/README.rst +++ b/README.rst @@ -33,15 +33,15 @@ * runs an external process and waits for it to finish * does not deadlock, no matter the process stdout/stderr output behaviour -* returns the exit code, stdout, stderr (separately), and the total process - runtime as a dictionary +* returns the exit code, stdout, stderr (separately, both as bytestrings), + and the total process runtime as a dictionary * process can run in a custom environment, either as a modification of the current environment or in a new environment from scratch * stdin can be fed to the process, the returned dictionary contains information how much was read by the process * stdout and stderr is printed by default, can be disabled * stdout and stderr can be passed to any arbitrary function for - live processing + live processing (separately, both as unicode strings) * optionally enforces a time limit on the process Credits diff --git a/docs/usage.rst b/docs/usage.rst index 3ae18c8..9216cac 100644 --- a/docs/usage.rst +++ b/docs/usage.rst @@ -9,11 +9,13 @@ To test for successful completion:: - assert result['exitcode'] == 0 + assert not result['exitcode'] + assert result['exitcode'] == 0 # alternatively To test for no STDERR output:: - assert result['stderr'] == '' + assert not result['stderr'] + assert result['stderr'] == b'' # alternatively To run with a specific environment variable set:: diff --git a/procrunner/__init__.py b/procrunner/__init__.py index a685749..1523e7d 100644 --- a/procrunner/__init__.py +++ b/procrunner/__init__.py @@ -53,7 +53,7 @@ __author__ = """Markus Gerstel""" __email__ = 'scientificsoftware@diamond.ac.uk' -__version__ = '0.6.1' +__version__ = '0.7.0' logger = logging.getLogger('procrunner') logger.addHandler(logging.NullHandler()) @@ -299,8 +299,8 @@ :param win32resolve: If on Windows, find the appropriate executable first. This allows running of .bat, .cmd, etc. files without explicitly specifying their extension. - :return: A dictionary containing stdout, stderr, runtime, exitcode, - and more. + :return: A dictionary containing stdout, stderr (both as bytestrings), + runtime, exitcode, and more. ''' time_start = time.strftime("%Y-%m-%d %H:%M:%S GMT", time.gmtime()) diff --git a/setup.cfg b/setup.cfg index 88e156c..b7a868e 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 0.6.1 +current_version = 0.7.0 commit = True tag = True diff --git a/setup.py b/setup.py index e175c12..b022198 100644 --- a/setup.py +++ b/setup.py @@ -50,6 +50,6 @@ test_suite='tests', tests_require=test_requirements, url='https://github.com/DiamondLightSource/python-procrunner', - version='0.6.1', + version='0.7.0', zip_safe=False, )