-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Fix GH-15796: Add the exit_status()
function
#19445
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
base: master
Are you sure you want to change the base?
Conversation
bb9e345
to
3b124ed
Compare
3b124ed
to
df352ca
Compare
df352ca
to
22a19ee
Compare
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.
Implementation LGTM, but given this is a feature, I've requested reviews from the RMs.
@@ -41,6 +41,8 @@ function strncasecmp(string $string1, string $string2, int $length): int {} | |||
|
|||
function error_reporting(?int $error_level = null): int {} | |||
|
|||
function exit_status(): int {} |
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.
function exit_status(): int {} | |
function exit_status(): ?int {} |
Would make more sense to indicate we are in shutdown process or not.
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'm not sure to get your comment. Where/when should this function return null?
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.
When exit
was not called yet.
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.
When exit is not called yet, the return code of the process will be 0. Also, it can be changed to 255 when an uncaught exception occurs. Thus, I'm not sure this function should return null
, because the process will always have an exit code, no matter what.
Fix #15796
Especially useful in shutdown handler, allows to get the current exit status code if set by an exit statement.