Bug #44217 [ReO->Csd]: Output after stdout/stderr closed cause immediate exit with status 0

From: Date: Tue, 19 Jun 2018 10:31:44 +0000
Subject: Bug #44217 [ReO->Csd]: Output after stdout/stderr closed cause immediate exit with status 0
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-215785@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=44217&edit=1 ID: 44217 Updated by: cmb@php.net Reported by: exe at travian dot org Summary: Output after stdout/stderr closed cause immediate exit with status 0 -Status: Re-Opened +Status: Closed Type: Bug Package: CGI/CLI related Operating System: * PHP Version: 5.*, 6CVS (2009-01-21) Assigned To: cmb Block user comment: N Private report: N New Comment: Automatic comment on behalf of robberphex@gmail.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=ecc1a7c582bf8de1eaa619ac4451399ed58f502a Log: Fix bug #44217: Output after stdout/stderr closed cause immediate exit with status 0 Previous Comments: ------------------------------------------------------------------------ [2018-06-19 10:13:15] cmb@php.net Re-opening wrt. <https://github.com/php/php-src/pull/3306>. ------------------------------------------------------------------------ [2018-06-15 06:52:01] robberphex at gmail dot com When ignore_user_abort is 0, php should exit with non-zero code: https://github.com/php/php-src/pull/3306 ------------------------------------------------------------------------ [2009-07-23 22:41:57] jani@php.net See bug #48803, using ignore_user_abort=1 "fixes" this for you. ------------------------------------------------------------------------ [2008-06-28 19:35:29] work at anomalizer dot net I guess what you are asking for is something like this to happen when you close STDOUT dup2(open("/dev/null", O_WRONLY), 1); ------------------------------------------------------------------------ [2008-04-27 13:40:51] duane at e164 dot org The solution to stopping this output is rather simple. After you close the stdin/stdout/stderr open 3 new file descriptors to /dev/null and all output goes bye bye. eg. fclose(STDIN); fclose(STDOUT); fclose(STDERR); $fp1 = fopen('/dev/null', 'r'); $fp2 = fopen('/dev/null', 'w'); $fp3 = fopen('/dev/null', 'w'); ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=44217 -- Edit this bug report at https://bugs.php.net/bug.php?id=44217&edit=1

« previous php.bugs (#215785) next »