It turns out, there's both a chef-solo
and a chef-solo.bat
in the chef directory. Running chef-solo
on the command line executes chef-solo.bat
. This doesn't work through QProcess
, where you have to explicitly list chef-solo.bat
in order for it to run the program.
Program executed using QProcess fails to start
Question
I'm trying to execute a process using QProcess
on Windows, but it keeps failing to start. Here's the code I'm using:
env = QtCore.QProcessEnvironment.systemEnvironment()
proc = QtCore.QProcess()
proc.setProcessEnvironment(env)
proc.start('chef-solo --version') # works on command line
# proc.start('\\opscode\\chef\\bin\\chef-solo --version') # works on command line
# proc.start('c:\\opscode\\chef\\bin\\chef-solo --version') # works on command line
# proc.start('chef-solo', '--version') # doesn't work (no command line analog)
# proc.start('chef-solo', ['--version']) # doesn't work (no command line analog)
# proc.start('ping www.google.com') # works!
if not proc.waitForStarted():
print "didn't start", proc.error()
This invariably prints didn't start 0
. proc.error()
is 0
, proc.readAllStandardError()
and proc.readAllStandardOutput()
are empty. The PATH
variable is set correctly in env
, and besides I'm specifying the full path to the program. What am I doing wrong?
Solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow