如何在后台运行 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 但我该怎么做呢?