[PATCH] prevent console windows popping up on windows while updating svn subrepos
Adrian Buehlmann
adrian at cadifra.com
Tue May 24 14:00:04 CDT 2011
On 2011-05-24 17:29, Dmitry Yakimenko wrote:
> # HG changeset patch
> # User Dmitry Yakimenko <dmitry.yakimenko at nokia.com>
> # Date 1306250795 -7200
> # Branch stable
> # Node ID 670c77865e53fe7f184d28d45cf7c5562a1796c8
> # Parent 3cb1e95676ad089596bd81d0937cad37d6e3b7fb
> prevent console windows popping up on windows while updating svn subrepos
>
> svnsubrepo._svncommand changed to spawn 'svn.exe' with _SW_HIDE flag on
> Windows. This prevents blank console windows being created for every
> instance of svn when Hg is running inside consoleless process like
> TortoiseHg. The fix imports a couple of symbols win32.py only inside
> "if os.name == 'nt'" which should be safe on other paltforms.
>
> diff -r 3cb1e95676ad -r 670c77865e53 mercurial/subrepo.py
> --- a/mercurial/subrepo.py Sun May 01 05:53:28 2011 -0500
> +++ b/mercurial/subrepo.py Tue May 24 17:26:35 2011 +0200
> @@ -537,9 +537,17 @@
> env = dict(os.environ)
> # Avoid localized output, preserve current locale for everything else.
> env['LC_MESSAGES'] = 'C'
> + # Prevent a blank console window popping up on Windows
> + startupinfo = None
> + if os.name == 'nt':
> + from win32 import _STARTF_USESHOWWINDOW, _SW_HIDE
These are not supposed to be imported. That's why they start with an
underscore.
> + 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
http://docs.python.org/library/subprocess.html#subprocess.STARTF_USESHOWWINDOW
> p = subprocess.Popen(cmd, bufsize=-1, close_fds=util.closefds,
> stdout=subprocess.PIPE, stderr=subprocess.PIPE,
> - universal_newlines=True, env=env)
> + universal_newlines=True, env=env,
> + startupinfo=startupinfo)
> stdout, stderr = p.communicate()
> stderr = stderr.strip()
> if stderr:
More information about the Mercurial-devel
mailing list