Bug #44217 [Com]: Output after stdout/stderr closed cause immediate exit
| From: | robberphex at gmail dot com | Date: | Fri, 15 Jun 2018 06:52:05 +0000 |
| Subject: | Bug #44217 [Com]: Output after stdout/stderr closed cause immediate exit | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-215731@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
Comment by: robberphex at gmail dot com
Reported by: exe at travian dot org
Summary: Output after stdout/stderr closed cause immediate
exit
Status: Not a bug
Type: Bug
Package: Filesystem function related
Operating System: *
PHP Version: 5.*, 6CVS (2009-01-21)
Block user comment: N
Private report: N
New Comment:
When ignore_user_abort is 0,
php should exit with non-zero code: https://github.com/php/php-src/pull/3306
Previous Comments:
------------------------------------------------------------------------
[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');
------------------------------------------------------------------------
[2008-02-25 11:54:22] exe at travian dot org
I'd expect php to discard every output after STDOUT is closed, instead of doing a silent exit
(which is hard to track because no error handler or shutdown function is called). Another option (if
output in this situation is considered to be an error) would be to trigger a warning/fatal and/or
call the shutdown function. This would, at least, make it possible to track this issue.
I have to close STDOUT and STDERR in a daemonized processes to detach from the controlling terminal.
------------------------------------------------------------------------
[2008-02-24 00:40:01] jani@php.net
Another bug #44218 describes some more expected behaviour caused by closing the input/output
streams.
NOTE: Correct manual page: http://www.php.net/manual/en/wrappers.php.php
------------------------------------------------------------------------
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