zenstruck / console-extra

A modular set of features to reduce configuration boilerplate for your Symfony commands.
MIT License
78 stars 3 forks source link

Support/document async #52

Closed tacman closed 1 year ago

tacman commented 1 year ago

What about a runCommandAsync method, that works the same way the Symfony Process component works?

https://symfony.com/doc/current/components/process.html#running-processes-asynchronously

kbond commented 1 year ago

Yeah, that would be cool. You're thinking this method would build a Process object based on the command (and the current script)? For example, runCommandAsync('some:command foo bar') would convert to a process: bin/console some:command foo bar?

I think the first step would be to add a RunsProcesses::runProcessAsync() method (to be used by RunsCommands).

tacman commented 1 year ago

Yes, that's what I was thinking, though I'm not sure. I'm seeing some cases where I would benefit from a ->wait() method, but I want to use this rather than the Symfony process.

kbond commented 1 year ago

I'm thinking runCommandAsync() would return the Process so you could manually call wait() if desired.

tacman commented 1 year ago

Alternatively, using RunCommandMessage (Symfony 6.4) may accomplish the goal of handling long-running tasks. So I'll close this.