HELP: Strange behaviour of subprocess

P

Pekka Niiranen

Hi there

I have installed Cygwin to my w2k machine and use
Python to execute Bash -shell scripts. I noticed
that in script below parameter "shell=False"
causes raw_input() to fail; the only way to
stop script is to kill the Dos window where
it is run (The Bash shell runs OK listing
directory contents to screen).

Any comments anybody?

---script starts--
import os, subprocess, sys

try:
retcode = subprocess.call("c:\\cygwin\\bin\\bash.exe -c\
/usr/bin/ls", shell=False)
if retcode < 0:
print >>sys.stderr, "Child was terminated by signal", -retcode
else:
print >>sys.stderr, "Child returned", retcode
except OSError, e:
print >>sys.stderr, "Execution failed:", e
raw_input("press any key")

---script ends--
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,262
Messages
2,571,052
Members
48,769
Latest member
Clifft

Latest Threads

Top