This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author nthompson
Recipients nthompson
Date 2017-10-27.00:20:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1509063633.12.0.213398074469.issue31881@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-10-27 00:20:33nthompsonsetrecipients: + nthompson
2017-10-27 00:20:33nthompsonsetmessageid: <1509063633.12.0.213398074469.issue31881@psf.upfronthosting.co.za>
2017-10-27 00:20:32nthompsonlinkissue31881 messages
2017-10-27 00:20:31nthompsoncreate