-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Remove shutdown handling from Drush #5840
base: 12.x
Are you sure you want to change the base?
Conversation
This will make it much harder for folks to diagnose misplaced I agree about starting a Drush 13 branch for this. |
The behavior change for those folks is that they no longer see "Drush terminated abnormally". You think thats very helpful? A redirect during a Cli request is a fatal error and the exit code will be a failure. The php fatal should be printed in most cases. Or I'm mistaken? How is it much harder to debug the redirect case without this code? |
Current behavior, without this PR, after adding
With this PR:
The main issue here is with support; it's harder for a remote support agent to know why Drush is not doing anything. The user can run again with
We could document in the FAQ that a sudden silent exit after Perhaps this is sufficient. I guess the other question, though, is what additional effects are caused when mixing #5823 with the shutdown handler? It might be helpful for ISPs to install their own shutdown handler when running Drush, if the side effects of doing so wouldn't be too great. It would be useful to be able to maintain the error message for support purposes, and running interactive commands in On-Server Development mode is less common. |
I'm not sure that exit(0) test says much. Nobody does that. I have also seen sites using redirects like you said. I added a header() call to settings.php and it was did nothing in my test. I guess PHP CLI ignores this function nowadays. An ISP can certainly add own shutdown handler via a custom commandfile. |
I believe the pattern a lot of folks use involves calling
Yes, and this would work even better if we retained the |
We would have to keep too much of our shutdown api. Its not just setCompleted(). I dont think there are unusual difficult side effects for ISPs who add own shutdown handler. They will receive UserAbortException cases as well as your exit() example. The exit(1) is what Laravel Prompts does after a user cancels the prompt. |
I am suggesting keeping the setCompleted function implementation itself, and the three calls that we make to it.
I am not entirely opposed to removing the shutdown handler as a simplification / modernization move, but it makes me sad that the reason we're doing it because the Laravel code is calling I'd like to suggest that we just make the shutdown handler quiet in Drush 12 if the exit code is non-zero (since presumably any code that calls exit(1) should usually print an error message itself before quitting), and just think about removing it completely in Drush 13 (don't rush to make the new major release for this). I don't know if that passes the backwards-compatible sniff test for Drush 12, though. |
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 have a couple comments on what I would prefer, but you have my 👍 to move forward with modernization if you don't like the alternatives.
Done. Lets sit with this for a bit and see if more changes are desired. |
src/Runtime/Runtime.php
Outdated
@@ -109,40 +110,18 @@ protected function doRun($argv, $output): int | |||
// Bootstrap: bootstrap site to the level requested by the command (via a 'post-init' hook) | |||
$status = $application->run($input, $output); | |||
|
|||
// Placate the Drush shutdown handler. | |||
// Placate the Drush shutdown handler (@todo remove for v13). |
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.
Is this PR targeting Drush 12 or Drush 13?
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.
If we remove the shutdown handler in Drush 12, then it might be hard to know whether an external shutdown handler is needed. If this PR targets Drush 13, then maybe the comment should say v14?
I'm still leaning towards opening a 13 branch now. I dont feel strongly about it. Anyone have a preference? The Prompts PR has a minor backward compat issue with the text() method now being a prompt. |
I prefer putting this in a Drush 13 branch, because otherwise it would be hard to know whether to add an auxiliary shutdown handler or not. |
Prompts no longer needs this removal so lets think about this PR a bit more. No rush. |
In order to simplify Drush, and integrate better with #5823, we remove our shutdown API.
I'm inclined to start a Drush 13 branch with this PR and Prompts.