comparison hglib/util.py @ 74:a5dd7b5d0be1

util, popen: hide subprocess window so a console doesn't open up on Windows
author Idan Kamara <idankk86@gmail.com>
date Mon, 26 Sep 2011 22:37:46 +0300
parents 77ae99e032f6
children 4282391dd693
comparison
equal deleted inserted replaced
73:77ae99e032f6 74:a5dd7b5d0be1
131 """ Returns True if the return code was 0, False otherwise """ 131 """ Returns True if the return code was 0, False otherwise """
132 return self.ret == 0 132 return self.ret == 0
133 133
134 close_fds = os.name == 'posix' 134 close_fds = os.name == 'posix'
135 135
136 startupinfo = None
137 if os.name == 'nt':
138 startupinfo = subprocess.STARTUPINFO()
139 startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
140
136 def popen(args, env={}): 141 def popen(args, env={}):
137 environ = None 142 environ = None
138 if env: 143 if env:
139 environ = dict(os.environ) 144 environ = dict(os.environ)
140 environ.update(env) 145 environ.update(env)
141 146
142 return subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE, 147 return subprocess.Popen(args, stdin=subprocess.PIPE, stdout=subprocess.PIPE,
143 stderr=subprocess.PIPE, close_fds=close_fds, 148 stderr=subprocess.PIPE, close_fds=close_fds,
144 env=environ) 149 startupinfo=startupinfo, env=environ)