[PATCH] prevent console windows popping up on windows while updating svn subrepos

Adrian Buehlmann adrian at cadifra.com
Wed May 25 05:03:44 CDT 2011

On 2011-05-25 10:16, dmitry.yakimenko at nokia.com wrote:
>>> +            startupinfo = subprocess.STARTUPINFO()
>>> +            startupinfo.dwFlags |= _STARTF_USESHOWWINDOW
>>> +            startupinfo.wShowWindow = _SW_HIDE
>> Why don't you use Python's subprocess.STARTF_USESHOWWINDOW and
>> subprocess.SW_HIDE
> That was my original implementation, but it behaves differently on different versions of Python.  Sometimes it's  subprocess.SW_HIDE and sometimes it's subprocess._ subprocess .SW_HIDE (http://stackoverflow.com/questions/4703983/).  I had to pollute the code with compatibility workarounds first.  Then I noticed that Mercurial already has these constants defined, so I used them.

Ah, Yes. The Python folks privatized that stuff in Python 2.7, so we
shouldn't use it. I forgot about that (I think I ran into that as well
in the past).

> As Mads Kiilerich suggested it would make more sense to move that into util.py.  I noticed there're two functions popen2 and popen3 which do something similar.  I'm not familiar enough with the Mercurial codebase to make a well evaluated decision if it would be safe to add that extra parameter to popen2 and popen3.

I think we could add that parameter to popen3 and probably provide an an
override implementation of popen3 for windows in mercurial.win32 using

> Maybe you could use this patch just as an example and modify the code in the way that seems the most appropriate to you.  I could create a ticket in the bug database and describe how this could be fixed.

My problem is, I don't use neither subversion nor mercurial subrepos
(doh!), so I'm not really an expert for your high level use case.

But I think I might be able to provide a suitable implementation of
popen3 in win32.py using ctypes (I'm used to hacking there), so you
could then use that and test it.


More information about the Mercurial-devel mailing list