Re: [問題] cgi如何以背景執行一個外部程式

看板Perl作者 (你這可惡的騙子)時間18年前 (2007/06/23 01:36), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串2/3 (看更多)
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

06/23 06:28, , 1F
謝謝 所以說STDOUT先關的做法是沒錯的了orz
06/23 06:28, 1F
文章代碼(AID): #16V0YkAC (Perl)
文章代碼(AID): #16V0YkAC (Perl)