我正在通过Symfony运行Linux的命令。现在,当我运行“ supervisorctl”命令时,它给了我错误,而运行其他sudo命令会返回正确的响应。
我的代码:
// get status of jobs
$process = Process::fromShellCommandline('supervisorctl status');
$process->run();
// executes after the command finishes
if (!$process->isSuccessful()) {
throw new ProcessFailedException($process);
}
echo $process->getOutput();