我试图从python脚本中执行一个带有命令行参数的java程序。我在python中使用CommandRunner并调用其execute()方法,如下所示:
result = remote_command_runner_util.CommandRunner(command, host, user).execute()
我无法执行上面的命令调用,当传入命令的输入参数,如java com.test.helloWorld
,并且带有一些有效的用户和主机变量时。你知道吗
是否可以使用CommandRunner从Python调用java程序?(这是我唯一的选择)。你知道吗
唯一重要的技巧(从安全性的角度来看)是安全地转义参数向量如果使用
subprocess
(因为它允许shell=False
)是可以避免的,但是使用CommandRunner是不可避免的。你知道吗…之后用作:
相关问题 更多 >
编程相关推荐