+ s = Sopen(cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True)
+ #(f_in, f_out, f_err) = os.popen3(cmd)
+ (f_in, f_out, f_err) = (s.stdin, s.stdout, s.stderr)
+ lout, lin, lerr = select([f_out,f_err], [], [], COMMAND_TIMEOUT*2)
+ if len(lin) == 0 and len(lout) == 0 and len(lerr) == 0:
+ # Reached a timeout!
+ #print "TODO: kill subprocess: '%s'" % cmd
+ # TODO: kill subprocess??
+ s.kill()
+ return ("", "SCRIPTTIMEOUT")
+ o_value = f_out.read()
+ e_value = ""
+ if o_value == "": # An error has occured
+ e_value = f_err.read()
+
+ o_value = o_value.strip()
+ e_value = e_value.strip()
+
+ f_out.close()
+ f_in.close()
+ f_err.close()
+ return (o_value, e_value)
+
+ def run_noexcept2(self, cmd):
+