Hi all, here’s another issue I’m having. When I spawn a process in a post script, I can’t get the script to wait for a return code (The script previously ran fine in deadline 5). Here’s a quick example that I knocked up. I’m running Deadline 6 RC 1 on Windows 7.
# spawnprocess-test.py - run as a post script to a Windows Deadline 6 client
from System.IO import *
from Deadline.Scripting import *
from System.Diagnostics import Process
import tempfile
from time import gmtime, strftime, localtime
def __main__(self):
time = strftime("%a, %d %b %Y %X", localtime())
print( "\n\n" + time + " Running Post Script: spawnprocess-test.py\n============================\n" )
tempFolder = tempfile.gettempdir()
testBatFilePath = (tempFolder + "\\tempfile.bat")
f = open(testBatFilePath,'w')
f.write("ping 0 -n 30 > nul\necho Finished \nexit")
f.close()
print( "Created " + testBatFilePath )
time = strftime("%a, %d %b %Y %X", localtime())
print( time + " Spawning process: " + testBatFilePath )
process = ProcessUtils.SpawnProcess(testBatFilePath)
ProcessUtils.WaitForExit( process, -1 )
returnCode = process.ExitCode
returnCode = str(returnCode)
time = strftime("%a, %d %b %Y %X", localtime())
print (time + " Spawn process returned: " + returnCode);
The post script successfully runs the automatically created batch file, however it completes (as far as deadline is concerned) straight away, even though the batch file is waiting for 30 seconds.Interestingly, the log does not seem to print the last statement. Any help would be great.
Thanks, Adrian