Message305094
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. |
|
Date |
User |
Action |
Args |
2017-10-27 00:20:33 | nthompson | set | recipients:
+ nthompson |
2017-10-27 00:20:33 | nthompson | set | messageid: <1509063633.12.0.213398074469.issue31881@psf.upfronthosting.co.za> |
2017-10-27 00:20:32 | nthompson | link | issue31881 messages |
2017-10-27 00:20:31 | nthompson | create | |
|