public function executeInBackground(Job $job) { $pb = new ProcessBuilder(); // PHP wraps the process in "sh -c" by default, but we need to control // the process directly. /* if ( ! defined('PHP_WINDOWS_VERSION_MAJOR')) { $pb->add('exec'); } */ //TODO //$console = $this->getContainer()->getParameter('kernel.root_dir').'/console'; $console = __DIR__ . '/../../../../app/console'; $pb->add('php')->add($console)->add(sprintf('--env=%s', $this->environment)); if (false) { $pb->add('--verbose'); } $pb->add('pumukit:encoder:job')->add($job->getId()); $process = $pb->getProcess(); $command = $process->getCommandLine(); $this->logger->addInfo('[executeInBackground] CommandLine ' . $command); shell_exec("nohup {$command} 1> /dev/null 2> /dev/null & echo \$!"); //$process->disableOutput(); //$process->start(); //$process->run(); //dump($process->getOutput()); //dump($process->getErrorOutput()); //dump($process->getCommandLine()); }