##// END OF EJS Templates
jobctrl: use shell for subprocess if trying without it fails
vivainio2 -
Show More
@@ -139,14 +139,26 b' def jobctrl_shellcmd(ip,cmd):'
139 else:
139 else:
140 use_shell = False
140 use_shell = False
141
141
142 p = Popen(cmd,shell = use_shell)
142 jobentry = None
143 jobentry = 'tasks/t' + str(p.pid)
144
145 try:
143 try:
144 try:
145 p = Popen(cmd,shell = use_shell)
146 except WindowsError:
147 if use_shell:
148 # try with os.system
149 os.system(cmd)
150 return
151 else:
152 # have to go via shell, sucks
153 p = Popen(cmd,shell = True)
154
155 jobentry = 'tasks/t' + str(p.pid)
146 ip.db[jobentry] = (p.pid,cmd,os.getcwd(),time.time())
156 ip.db[jobentry] = (p.pid,cmd,os.getcwd(),time.time())
147 p.communicate()
157 p.communicate()
158
148 finally:
159 finally:
149 del ip.db[jobentry]
160 if jobentry:
161 del ip.db[jobentry]
150
162
151
163
152 def install():
164 def install():
General Comments 0
You need to be logged in to leave comments. Login now