作者jlovet (你这可恶的骗子)
看板perl
标题Re: [问题] cgi如何以背景执行一个外部程式
时间Sat Jun 23 01:36:44 2007
man 2 fork
* The child inherits copies of the parent's set of open file descrip-
tors. Each file descriptor in the child refers to the same open
file description (see open(2)) as the corresponding file descriptor
in the parent. This means that the two descriptors share open file
status flags, current file offset, and signal-driven I/O attributes
(see the description of F_SETOWN and F_SETSIG in fcntl(2)).
我想应该是因为这个关系吧
因为在你的Perl执行system之前有打开了档案 (就是输出到你网页上的...)
这个file handle 被system执行的东西继承了...
所以...在你child 结束之前,这档案都是保持打开状态
恩...就这样
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 140.123.235.194
1F:推 megaman1206:谢谢 所以说STDOUT先关的做法是没错的了orz 06/23 06:28