-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Console][Messenger] add RunCommandMessage
and RunCommandMessageHandler
#49814
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.
8000 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
Conversation
ExecuteCommand
and ExecuteCommandHandler
ExecuteCommand
and ExecuteCommandHandler
Like #49813 (comment), maybe |
65c65a0
to
592dc48
Compare
$input = new StringInput($message->input); | ||
$output = new BufferedOutput(); | ||
|
||
$this->application->setCatchExceptions($message->catchExceptions); |
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.
Should I clone the application here instead of having the service not-shared?
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.
maybe try/finally to modify state on the shared service?
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 don't think I can do this as there's no way to access the current state of Application::$catchExceptions
.
src/Symfony/Component/Console/Messenger/ExecuteCommandHandler.php
Outdated
Show resolved
Hide resolved
848bdb7
to
f712569
Compare
src/Symfony/Component/Console/Messenger/ExecuteCommandHandler.php
Outdated
Show resolved
Hide resolved
One thing I think is missing: making the output available if there's an exception. Consider a system that tracks messages and emails an admin on failure. I can attest that this is valuable information. What about wrapping the caught exception in a new In #49813 this is possible because the thrown exception ( |
) { | ||
} | ||
|
||
public function __toString(): string |
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.
see also #49813 (comment)
$input = new StringInput($message->input); | ||
$output = new BufferedOutput(); | ||
|
||
$this->application->setCatchExceptions($message->catchExceptions); |
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.
maybe try/finally to modify state on the shared service?
src/Symfony/Component/Console/Messenger/ExecuteCommandHandler.php
Outdated
Show resolved
Hide resolved
src/Symfony/Component/Console/Messenger/ExecuteCommandHandler.php
Outdated
Show resolved
Hide resolved
I've updated this PR:
(updated PR description to show usage) |
ExecuteCommand
and ExecuteCommandHandler
RunCommandMessage
and RunCommandMessageHandler
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.
LGTM, @kbond I've made a rename suggestion.
10f89d1
to
dd5b0b7
Compare
Thank you @kbond. |
Similar to #49813, when using the scheduler it could be useful to execute commands.
Usage
TODO: