Symfony 4进程正在运行命令,但未运行 [英] symfony 4 process running a command, not running

查看:12
本文介绍了Symfony 4进程正在运行命令,但未运行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个名为:

的命令
broker:create-device

它接受2个命令行参数。当我通过命令行运行时,它起作用了。

现在,我想从控制器运行。所以我在另一篇Stack Overflow帖子中读到了我可以做的:

    $process = new Process(['php bin/console broker:create-device',1,2]);
    $process->run();

确实会执行该命令,但日志仅显示弃用错误:

[2019-02-07 17:04:13] php.INFO: User Deprecated: The "SymfonyBundleFrameworkBundleCommandContainerAwareCommand" class is deprecated since Symfony 4.2, use "SymfonyComponentConsoleCommandCommand" with dependency injection instead. {"exception":"[object] (ErrorException(code: 0): User Deprecated: The "Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand" class is deprecated since Symfony 4.2, use "Symfony\Component\Console\Command\Command" with dependency injection instead. at /Users/myuser/Code/site/vendor/symfony/framework-bundle/Command/ContainerAwareCommand.php:18)"} []
但是,Execute中的实际代码并未运行。知道为什么吗?

推荐答案

似乎每个空格都需要分隔,而不仅仅是论点...

因此将上述流程编辑为

$PROCESS=新进程([‘php’,‘bin/控制台’,‘Broker:Create-Device’,1,2]);

这篇关于Symfony 4进程正在运行命令,但未运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆