1084 """Build a command string suitable for os.popen* calls.""" |
1084 """Build a command string suitable for os.popen* calls.""" |
1085 # The extra quotes are needed because popen* runs the command |
1085 # The extra quotes are needed because popen* runs the command |
1086 # through the current COMSPEC. cmd.exe suppress enclosing quotes. |
1086 # through the current COMSPEC. cmd.exe suppress enclosing quotes. |
1087 return '"' + cmd + '"' |
1087 return '"' + cmd + '"' |
1088 |
1088 |
1089 def popen(command): |
1089 def popen(command, mode='r'): |
1090 # Work around "popen spawned process may not write to stdout |
1090 # Work around "popen spawned process may not write to stdout |
1091 # under windows" |
1091 # under windows" |
1092 # http://bugs.python.org/issue1366 |
1092 # http://bugs.python.org/issue1366 |
1093 command += " 2> %s" % nulldev |
1093 command += " 2> %s" % nulldev |
1094 return os.popen(quotecommand(command)) |
1094 return os.popen(quotecommand(command), mode) |
1095 |
1095 |
1096 def explain_exit(code): |
1096 def explain_exit(code): |
1097 return _("exited with status %d") % code, code |
1097 return _("exited with status %d") % code, code |
1098 |
1098 |
1099 # if you change this stub into a real check, please try to implement the |
1099 # if you change this stub into a real check, please try to implement the |
1250 return "'%s'" % s.replace("'", "'\\''") |
1250 return "'%s'" % s.replace("'", "'\\''") |
1251 |
1251 |
1252 def quotecommand(cmd): |
1252 def quotecommand(cmd): |
1253 return cmd |
1253 return cmd |
1254 |
1254 |
1255 def popen(command): |
1255 def popen(command, mode='r'): |
1256 return os.popen(command) |
1256 return os.popen(command, mode) |
1257 |
1257 |
1258 def testpid(pid): |
1258 def testpid(pid): |
1259 '''return False if pid dead, True if running or not sure''' |
1259 '''return False if pid dead, True if running or not sure''' |
1260 if os.sys.platform == 'OpenVMS': |
1260 if os.sys.platform == 'OpenVMS': |
1261 return True |
1261 return True |