New submission from Nick <nathomps...@protonmail.com>: If subprocess.run is called with a single string, say:
completed_ps = subprocess.run('mpirun -np 4 myexe.x moreargs', shell=True) and 'myexe.x moreargs' fails with a returncode of 1, then 'completed_ps.returncode' is None. However, if we split the args with shlex, we obtain the desired result, which is a returncode of 1: import shlex args = shlex.split('mpirun -np 4 myexe.x moreargs') completed_ps = subprocess.run(args) # now completed_ps.returncode = 1 if myexe.x moreargs fails. Reproduced on Mac, Ubuntu 17.04, Python 3.6.1 and Python 3.6.3. ---------- messages: 305094 nosy: nthompson priority: normal severity: normal status: open title: subprocess.returncode not set depending on arguments to subprocess.run versions: Python 3.6 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue31881> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com