Closed ostrolucky closed 1 year ago
If the Process
object is destroyed while the process is running, the process is killed. If you want to wait for the process to finish execution, you need to wait on the promise returned from Process::join()
.
I don't want to wait, I want to exit immediately and let process finish in background
Currently we don't directly support daemonizing child processes. Maybe you can get it work with nohup
/ setsid
? I tried, but I failed.
Yeah I don't know how to do that either, what you currently use at https://github.com/amphp/process/blob/355b1e561b01c16ab3d78fada1ad47ccc96df70e/lib/Internal/Posix/Runner.php#L82-L83 is black magic for me.
Also please remove wrong label.
A possible solution is adding a method to Process
, perhaps daemonize()
, that sets a flag to not automatically kill the child process when the Process
object is destroyed. The current default behavior would not be altered, but that would enable what @ostrolucky is trying to accomplish.
yeah that would work for me
This won't be supported for now, because the process would have to be properly disowned to avoid zombie processes.
wrapper.php
Following works as expected, outputs
foo
, exits immediately and after 1 second creates file 'a'.Following does not work as expected. Outputs
foo
, exits immediately but file is not created.