我正在尝试在我的共享托管服务器上的 Laravel 应用程序中使用 Symfony 启动一个进程,该进程将调用带有如下参数的 Artisan 命令:
$process = new Process(['/usr/local/bin/php', base_path('artisan'), 'queue:work --stop-when-empty']);
$process->setTimeout(null);
$process->start();
这不起作用,因为我得到:
ERROR: Command "queue:work --stop-when-empty" is not defined.
Did you mean one of these?
queue:batches-table
queue:clear
queue:failed
queue:failed-table
queue:flush
queue:forget
queue:listen
queue:monitor
queue:prune-batches
queue:prune-failed
queue:restart
queue:retry
queue:retry-batch
queue:table
queue:work {"exception":"[object] (Symfony\\Component\\Console\\Exception\\CommandNotFoundException(code: 0): Command \"queue:work --stop-when-empty\" is not defined.
问题在于参数--stop-when-empty
,因为命令在没有它的情况下成功运行。如何将此参数传递给命令?