New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When print failed, exit with 255 #3306
Conversation
sapi/cli/php_cli.c
Outdated
@@ -317,10 +313,9 @@ static size_t sapi_cli_ub_write(const char *str, size_t str_length) /* {{{ */ | |||
while (remaining > 0) | |||
{ | |||
ret = sapi_cli_single_write(ptr, remaining); | |||
if (!ret) { | |||
#ifndef PHP_CLI_WIN32_NO_CONSOLE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The removal of this macro seems wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I look php_handle_aborted_connection
through, it works with PHP_CLI_WIN32_NO_CONSOLE
.
When at Win32, why not call php_handle_aborted_connection
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to the usual php.exe
there is a binary variant php-win.exe
dedicated to specifically have no console I/O.
Thanks.
@cmb69 you'll want to look at this one ... |
sapi/cli/php_cli.c
Outdated
{ | ||
#ifdef PHP_WRITE_STDOUT | ||
zend_long ret; | ||
#else | ||
size_t ret; | ||
ssize_t ret; | ||
#endif | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to me that we should declare ssize_t ret;
unconditionally.
In my opinion, we should:
Otherwise, looks good to me. |
a86f58d
to
0abc7af
Compare
|
Thanks!
Well, the ticket claims that “Output after stdout/stderr closed cause immediate exit”, what would not be fixed by this pull request. The fix here is merely that an appropriate exit code code is set (which is good in my opinion). Anyway, if there are no objections, I'm going to apply this fix before 7.3.0alpha2 is tagged (presumably next Tuesday). |
Comment on behalf of cmb at php.net: Thanks! Applied via ecc1a7c. |
fix https://bugs.php.net/bug.php?id=44217