symfony - Symfony2 background process -
how can run symfony2 process in background?
my code:
class start extends symfony\component\console\command\command { protected function configure() { $this->setname('start'); } protected function execute(inputinterface $input, outputinterface $output) { $process = new process('java -jar ./selenium-server-standalone-2.42.2.jar'); $process->settimeout(null); $process->start(); $pid = $process->getpid(); $output->writeln(sprintf('started selenium pid %d', $pid)); $process->wait(); } } how can run process in background? guess should redirect stdout of new process /dev/null how can that?
oh, found possible in symfony 2.5+, updated , added
$process->disableoutput(); before $process->start() , works fine.
upd.
unfortunately, not work on windows. tried run 'start /b command' ,
'call command > nul 2>&1' but both of these failed: process running console still blocked.
Comments
Post a Comment