Steven D'Aprano <steve+comp.lang.pyt...@pearwood.info> writes:

> Alain Ketterlin wrote:

>>> I have a Python script which I would like to test without a tty attached
>>> to the process. I could run it as a cron job, but is there an easier way?

>> Isn't os.setsid() what you're looking for?[...]

> It doesn't appear so to me.
[...]
> [steve@sylar ~]$ python -c "import sys,os; print 
> os.isatty(sys.stdout.fileno())"
> True
> [steve@sylar ~]$ setsid python -c "import sys,os; print 
> os.isatty(sys.stdout.fileno())"
> True
>
> If I run the same Python command (without the setsid) as a cron job, I 
> get False emailed to me. That's the effect I'm looking for.

If that's what you mean by "without a tty attached", simply redirecting
standard channels should work, no?

-- Alain.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to