在 OpenShift 上通过 popen 启动命令
Launch command through popen on OpenShift
当我通过 popen
启动这个命令时
try:
os.popen("myCustomCmdHere")
except IOError:
logging.error('Error on myCustomCmdHere')
我没有错误,但命令没有启动
当我直接在 Openshift 控制台上启动 myCustomCmdHere 时,命令是正确的
rhc ssh -a myApp
cd app-root/repo/myApp
myCustomCmdHere
我需要在代码中添加什么才能在 Openshift 中使用 os.popen?
谢谢
尝试使用“&”启动一个单独的进程并发送到后台。我将其用于 Openshift 上的 python 3.3。
import subprocess
subprocess.Popen(['myCustomcmdHere &'])
或者这个
os.system("myCustomcmdHere &")
当我通过 popen
启动这个命令时try:
os.popen("myCustomCmdHere")
except IOError:
logging.error('Error on myCustomCmdHere')
我没有错误,但命令没有启动
当我直接在 Openshift 控制台上启动 myCustomCmdHere 时,命令是正确的
rhc ssh -a myApp
cd app-root/repo/myApp
myCustomCmdHere
我需要在代码中添加什么才能在 Openshift 中使用 os.popen?
谢谢
尝试使用“&”启动一个单独的进程并发送到后台。我将其用于 Openshift 上的 python 3.3。
import subprocess
subprocess.Popen(['myCustomcmdHere &'])
或者这个
os.system("myCustomcmdHere &")