I started with a simple test:
cat foo2.py #!/usr/bin/python import subprocess, sys, os def alert(): subprocess.Popen ("xterm &", shell=True, stdin=None, stdout=None, stderr=None, close_fds=True) if __name__ == "__main__": print "hello" alert () os._exit (0)
When I run this code on the command line regularly, it works:
./foo2.py
returns a unix prompt, and xterm is running in the background.
However, when I run this code with tee
./foo2.py | tee my.log
I don't get a unix prompt until I close xterm.
How can I get a python script to exit but keep xterm in the background?
I saw: Python spawns a child subprocess, disconnects and exits, and the activestate recipe mentioned there. I used this code to create a simple test pattern that simply opens xterm in the background:
cat foo.py
When I run this code on the command line regularly, it works:
./foo.py
returns a unix prompt, and xterm is running in the background.
However, when I run this code with tee
./foo.py | tee my.log
I don't get a unix prompt until I close xterm.
How can I get a python script to exit but keep xterm in the background?