Submitter | Olivier Trempe |
---|---|
Date | July 15, 2016, 5:42 p.m. |
Message ID | <0d3510a5c2fa6eec7ade.1468604524@ronce.innov.local> |
Download | mbox | patch |
Permalink | /patch/15944/ |
State | Not Applicable |
Headers | show |
Comments
On Fri, Jul 15, 2016 at 01:42:04PM -0400, Olivier Trempe wrote: > # HG changeset patch > # User Olivier Trempe <otrempe> > # Date 1468247986 14400 > # Mon Jul 11 10:39:46 2016 -0400 > # Node ID 0d3510a5c2fa6eec7ade62f73adf7d976a30edec > # Parent 9d02bed8477bec7f679d6aeb5b1dd8bcdb80f64d > fsmonitor: prevent command window pop-up when used with gui application > > diff -r 9d02bed8477b -r 0d3510a5c2fa hgext/fsmonitor/pywatchman/__init__.py > --- a/hgext/fsmonitor/pywatchman/__init__.py Tue Jul 12 22:26:04 2016 -0700 > +++ b/hgext/fsmonitor/pywatchman/__init__.py Mon Jul 11 10:39:46 2016 -0400 Please submit a Pull Request against the watchman project: the origin of the pywatchman library is here: https://github.com/facebook/watchman/tree/master/python/pywatchman Thanks! --Wez
Patch
diff -r 9d02bed8477b -r 0d3510a5c2fa hgext/fsmonitor/pywatchman/__init__.py --- a/hgext/fsmonitor/pywatchman/__init__.py Tue Jul 12 22:26:04 2016 -0700 +++ b/hgext/fsmonitor/pywatchman/__init__.py Mon Jul 11 10:39:46 2016 -0400 @@ -600,10 +600,18 @@ cmd = ['watchman', '--output-encoding=bser', 'get-sockname'] try: + + # if invoked via an application with a graphical user interface, + # this call will cause a brief command window pop-up. + # Using the flag STARTF_USESHOWWINDOW to avoid this behavior. + startupinfo = subprocess.STARTUPINFO() + startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW + p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, - close_fds=os.name != 'nt') + close_fds=os.name != 'nt', + startupinfo=startupinfo) except OSError as e: raise WatchmanError('"watchman" executable not in PATH (%s)', e)