Mercurial > hg
changeset 49393:b9fcf54030d7
subrepo: avoid opening console window for non-native subrepos on Windows
Prevent annoying command prompt windows popping up when using TortoiseHG with
Git and SVN subrepos by passing creationflags=subprocess.CREATE_NO_WINDOW to
subprocess.Popen.
author | derekbrowncmu@gmail.com |
---|---|
date | Mon, 18 Jul 2022 03:29:53 -0400 |
parents | 5baf873ccb6e |
children | 5cf73de964e1 |
files | mercurial/subrepo.py |
diffstat | 1 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/subrepo.py Wed Jul 13 17:13:33 2022 -0400 +++ b/mercurial/subrepo.py Mon Jul 18 03:29:53 2022 -0400 @@ -1099,6 +1099,10 @@ # --non-interactive. if commands[0] in (b'update', b'checkout', b'commit'): cmd.append(b'--non-interactive') + if util.safehasattr(subprocess, 'CREATE_NO_WINDOW'): + # On Windows, prevent command prompts windows from popping up when + # running in pythonw. + extrakw['creationflags'] = getattr(subprocess, 'CREATE_NO_WINDOW') cmd.extend(commands) if filename is not None: path = self.wvfs.reljoin( @@ -1469,6 +1473,11 @@ # insert the argument in the front, # the end of git diff arguments is used for paths commands.insert(1, b'--color') + extrakw = {} + if util.safehasattr(subprocess, 'CREATE_NO_WINDOW'): + # On Windows, prevent command prompts windows from popping up when + # running in pythonw. + extrakw['creationflags'] = getattr(subprocess, 'CREATE_NO_WINDOW') p = subprocess.Popen( pycompat.rapply( procutil.tonativestr, [self._gitexecutable] + commands @@ -1479,6 +1488,7 @@ close_fds=procutil.closefds, stdout=subprocess.PIPE, stderr=errpipe, + **extrakw ) if stream: return p.stdout, None