mirror of
https://github.com/php/php-src.git
synced 2024-09-21 09:57:23 +00:00
Fix interrupted CLI output causing the process to exit
When writing the output in the CLI is interrupted by a signal, the writing will fail in sapi_cli_single_write(), causing an exit later in sapi_cli_ub_write(). This was the other part of the issue in GH-11498. The solution is to restart the write if an EINTR has been observed. Closes GH-11510.
This commit is contained in:
parent
4d91665f78
commit
1111a9517b
3
NEWS
3
NEWS
@ -2,6 +2,9 @@ PHP NEWS
|
||||
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
||||
?? ??? ????, PHP 8.1.22
|
||||
|
||||
- CLI:
|
||||
. Fix interrupted CLI output causing the process to exit. (nielsdos)
|
||||
|
||||
- Date:
|
||||
. Fixed bug GH-11368 (Date modify returns invalid datetime). (Derick)
|
||||
|
||||
|
@ -262,7 +262,7 @@ PHP_CLI_API ssize_t sapi_cli_single_write(const char *str, size_t str_length) /*
|
||||
#ifdef PHP_WRITE_STDOUT
|
||||
do {
|
||||
ret = write(STDOUT_FILENO, str, str_length);
|
||||
} while (ret <= 0 && errno == EAGAIN && sapi_cli_select(STDOUT_FILENO));
|
||||
} while (ret <= 0 && (errno == EINTR || (errno == EAGAIN && sapi_cli_select(STDOUT_FILENO))));
|
||||
#else
|
||||
ret = fwrite(str, 1, MIN(str_length, 16384), stdout);
|
||||
if (ret == 0 && ferror(stdout)) {
|
||||
|
Loading…
Reference in New Issue
Block a user