-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Is Symfony process component work different between Linux and Max OS X? #20445
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
Comments
The goal of this component is to provide consistent process management across popular operating systems. What happens on OS X exactly? I'm not sure what you mean by " I could not got the process in Mac OS X". Is the PID not returned, or no output shown from the process? By the way, if you run symfony commands you need to be aware of: http://symfony.com/doc/current/components/process.html#process-pid |
@jakzal Exactly in OS X, $process->start() just like crash, Nothing happen and there's no any php process in the process moniter. For instance by what I'm doing now
afplay is a application to play music file in console, everything works well above, even without exec. Music show is going on, at the end I can see the ending words. But if I change run() method to start(), I just see "Music End baby :D" but without enjoying music anymore :( In Linux start() method means keep working like a daemon, but I find there is no same effect in OS X . Any idea? |
This is an expected behaviour. Process you started with Not sure why the linux process doesn't terminate in your case. |
@jakzal this is because on Linux, killing a process does not kill its child processes. So only the sh wrapper gets killed, and not the actual command on Linux. |
@jakzal wait, what ? According to you, we can't use the How to achieve the fire and forget thing with the |
running an asynchronous process is not the same than running a processing surviving yourselves. |
@stof got it, but I even use it as a feature in Linux, because I found it is really similar to a process of fork. I'm not sure if I can use $process = new Process("$consoleCommand &"); to make the process work in the background itself ? Is that suggested? Or something other solution like pcntl? |
This is unsupported on Symfony Process because the behavior of the OSes is different. There is no way I'm aware about to abstract these differences unfortunately. It doesn't mean you can't achieve it on your setup, it just mean nobody wrote such portable code for Symfony (and I doubt PHP provides the required primitives). |
As a result of #20513 a docs issue was raised to clarify this behaviour in the documentation. |
Uh oh!
There was an error while loading. Please reload this page.
I got different result in the same code like below
With a Symfony command A I create a process running at background asynchronously, and it work fine in Linux, and I got the new process and the Pid as the command output.
Symfony command A
Symfony command processA
But I could not got the process in Mac OS X, except I keep the Symfony command A live. Is there something wrong with the code or something different between Linux and Mac?
Linux: Ubuntu 15.10, PHP 5.6.11, Symfony 3.1.6
Mac OS: 10.11.6, PHP 5.5.38, Symfony 2.8.12
The text was updated successfully, but these errors were encountered: