forking + stdout = confusion

Roy Smith roy at popmail.med.nyu.edu
Wed Apr 14 11:28:18 EDT 1999


clarence at silcom.com (Clarence Gardner) wrote:
> That does indeed do the trick, but you probably had to os.close(2) also.
> (Both stdout and stderr normally are piped into Apache.)

I don't know how all Apaches work, but at least on our machine, cgis get
pipes for stdin and stdout, but stderr is connected directly to the error
log file.  I wrote a little test cgi which is just:

> #!/bin/sh
> sleep 300

opened http://my.host.name/cgi-bin/roy/sleeper.cgi and ran lsof, which is
a neat utility which mucks about in the kernel's file tables and shows you
what files a process has open.  I got:

COMMAND     PID   USER   FD   TYPE      DEVICE SIZE/OFF  NODE NAME   
sleep     25247 nobody    0r  FIFO  0x04a6ff00        0 22787
sleep     25247 nobody    1w  FIFO  0x04096e00        0 22788
sleep     25247 nobody    2w  VREG 3049,395040  4420204    90
/www/logs/error_log

-- 
Roy Smith <roy at popmail.med.nyu.edu>
New York University School of Medicine





More information about the Python-list mailing list