On 3/10/11 08:10:57, Hegedüs, Ervin wrote:
hello,
On Mon, Oct 03, 2011 at 04:37:43AM +0000, Steven D'Aprano wrote:
I wanted to ensure that it would do the right thing when run without a tty,
such as from a cron job.
If you fork() your process, then it will also loose the tty...
Errhm, I suggest you check again. This cannot be true.
import os
import sys
try:
pid = os.fork()
if pid> 0:
sys.exit(0)
except OSError, e:
sys.exit(1)
os.chdir("/")
os.setsid()
os.umask(0)
It is os.setsid() that makes you lose the tty.
Hope this helps,
-- HansM
--
http://mail.python.org/mailman/listinfo/python-list