2014-09-09 7 views
2

백그라운드에서 Symfony2 프로세스를 어떻게 실행합니까?Symfony2 백그라운드 프로세스

내 코드 :

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 with PID %d', $pid)); 
    $process->wait(); 
    } 

} 

가 어떻게 백그라운드에서이 프로세스를 실행할 수 있습니까? 나는 새 프로세스의 STDOUT을/dev/null로 리디렉션해야한다고 생각하지만 어떻게 할 수 있습니까?

답변

0

아, 나는 그것이 심포니 2.5 + 가능하다 발견, 그래서 난 그냥 업데이트 및 $ 프로세스 레 전에

$process->disableOutput(); 

추가> 시작()와 그것을 잘 작동합니다.

UPD.

불행히도 Windows에서는 작동하지 않습니다. 또한 'START/B 명령'과

'CALL command > nul 2>&1' 

하지만, 이러한 실패의 두 실행하려고 : 프로세스를 실행했지만, 콘솔은 여전히 ​​차단되었습니다.