Message8142
Sample printer.sh:
#! /bin/bash
for i in `seq 10`; do
echo -n O >&1
echo -n E >&2
done
Sample subproc_call.py:
#! /usr/bin/python
import subprocess
subprocess.call('./printer.sh')
When running subproc_call.py with cpython the output is always OEOEOEOEOEOEOEOEOEOE, as expected. When running with jython the output is usually OOOOOOOOOOEEEEEEEEEE but other variants are also possible.
The documentation of subprocess.Popen states by default "no redirection will occur; the child’s file handles will be inherited from the parent". Jython behaves differently in a way that introduces visible behavior changes.
Jython Popen with stdout=subprocess.PIPE and stderr.subprocess.STDOUT apparently behaves as expected. This can also happen if entire lines are printed, or with manual flushes. The following cpython print script also reproduces the issue:
#! /usr/bin/env python
import sys
for i in range(50):
sys.stdout.write('O\n')
sys.stdout.flush()
sys.stderr.write('E\n')
sys.stderr.flush() |
|
Date |
User |
Action |
Args |
2013-10-03 14:36:59 | cdleonard | set | recipients:
+ cdleonard |
2013-10-03 14:36:59 | cdleonard | set | messageid: <1380811019.22.0.259258302032.issue2096@psf.upfronthosting.co.za> |
2013-10-03 14:36:59 | cdleonard | link | issue2096 messages |
2013-10-03 14:36:58 | cdleonard | create | |
|