Dennis Lee Bieber <[EMAIL PROTECTED]> wrote:
>  On Tue, 28 Nov 2006 04:30:09 -0600, Nick Craig-Wood
> <[EMAIL PROTECTED]> declaimed the following in comp.lang.python:
> 
> > 
> > If you run this
> > 
> >   import os,sys,time
> >   print os.getpid()
> >   sys.stdout = open(os.devnull, 'w')
> >   time.sleep(60)
> > 
> > It prints its pid.
> >
>       I would hope so, as you performed the print BEFORE reassigning
>  stdout...

That is what I intended.  I wanted the pid to look in /proc/<pid>/fd
to see what file descriptors were really open.

>  import os,sys,time
>  print "pre:", os.getpid()
>  sys.stdout = open(os.devnull, 'w')
>  print "post:", os.getpid()
>  time.sleep(60)
> 
>  (Granted, I'm on WinXP; I also suspect the original stdout is still open
>  in the background, maybe dualled with stderr?)

Yes that is the point - the original stdout is still open.

I don't think this discussion is relevant to windows though - windows
has its own way of making daemons.

-- 
Nick Craig-Wood <[EMAIL PROTECTED]> -- http://www.craig-wood.com/nick
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to