-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
[Messenger][Process] add RunProcessMessage
and RunProcessMessageHandler
#49813
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
Conversation
ExecuteProcess
and ExecuteProcessHandler
ExecuteProcess
and ExecuteProcessHandler
src/Symfony/Component/Process/Messenger/ExecuteProcessHandler.php
Outdated
Show resolved
Hide resolved
Looking for feedback before proceeding further. |
ExecuteProcess
and ExecuteProcessHandler
ExecuteProcess
and ExecuteProcessHandler
ExecuteProcess
and ExecuteProcessHandler
ExecuteProcess
and ExecuteProcessHandler
ExecuteProcess
and ExecuteProcessHandler
ProcessMessage
and ProcessMessageHandler
17b805b
to
9a285c3
Compare
9a285c3
to
912bd22
Compare
|
912bd22
to
b3de71b
Compare
) { | ||
} | ||
|
||
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.
generally what about just dumping payloads ($dump($messsage)
) in CLI for -v[vv]?
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.
Can you explain this a bit more, I'm not understanding what you mean.
ProcessMessage
and ProcessMessageHandler
RunProcessMessage
and RunProcessMessageHandler
I've renamed the classes per the review. I've also added a |
src/Symfony/Component/Process/Messenger/RunProcessFailedException.php
Outdated
Show resolved
Hide resolved
src/Symfony/Bundle/FrameworkBundle/DependencyInjection/FrameworkExtension.php
Show resolved
Hide resolved
src/Symfony/Component/Process/Messenger/RunProcessFailedException.php
Outdated
Show resolved
Hide resolved
Comments addressed and PR description updated to show usage. |
src/Symfony/Component/Process/Messenger/RunProcessMessageHandler.php
Outdated
Show resolved
Hide resolved
c33ff60
to
abde61a
Compare
Thank you @kbond. |
…ommandMessageHandler` (kbond) This PR was squashed before being merged into the 6.4 branch. Discussion ---------- [Console][Messenger] add `RunCommandMessage` and `RunCommandMessageHandler` | Q | A | ------------- | --- | Branch? | 6.3 | Bug fix? | no | New feature? | yes | Deprecations? | no | Tickets | n/a | License | MIT | Doc PR | todo Similar to #49813, when using the scheduler it could be useful to execute commands. ## Usage ```php use Symfony\Component\Console\Exception\RunCommandFailedException; use Symfony\Component\Console\Messenger\RunCommandMessage; try { $context = $bus->dispatch(new RunCommandMessage('my:command')); $context->output; // string - output of command $context->exitCode; // int - the exit code catch(RunCommandFailedException $e) { // if exit code is non-zero or command threw exception $e->context->output; // string - output of command $e->context->exitCode; // int - the exit code $e->getPrevious(); // null|\Throwable exception command threw if applicable } // "never" fail $context = $bus->dispatch(new RunCommandMessage('my:command', throwOnNonSuccess: false, catchExceptions: true)); ``` TODO: - [x] wire up - [x] tests Commits ------- dd5b0b7 [Console][Messenger] add `RunCommandMessage` and `RunCommandMessageHandler`
When reviewing how I could replace my cron scheduler with symfony/scheduler, I realized I need a way to schedule processes.
Usage
TODO: