symfony: [Process] Process doesn't start if calling script terminates to quickly
I am attempting to use the Process component to spaw a second (long running) process. I use ProcessBuilder to create the process, then call $process->start(). The process will only actually execute if I make my calling script sleep(1). If it terminates immediately, the new process will not execute.
Is there a way to solve this?
About this issue
- Original URL
- State: closed
- Created 11 years ago
- Comments: 18 (12 by maintainers)
When using Symfony’s
Processclass in a cli environment, it is possible to keep the process running even after the main script ends. To do this, implement your own class and overload the__destruct()method to prevent the default behaviour that stops the process by sending a SIGTERM signal.IMO, I think the
Processclass should allow the option to not send SIGTERM when the Process object is destroyed.You should check this article
Did you try to setup a callback ? like it’s shown in the example ?