Details
Details
- Reviewers
indygreg - Group Reviewers
hg-reviewers - Commits
- rHG54f4d094bab1: procutil: suppress pytype warnings around windows-only attributes
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Lint Skipped - Unit
Unit Tests Skipped
indygreg |
hg-reviewers |
Lint Skipped |
Unit Tests Skipped |
Path | Packages | |||
---|---|---|---|---|
M | mercurial/utils/procutil.py (9 lines) |
Commit | Parents | Author | Summary | Date |
---|---|---|---|---|
ceea3ae860ea | 13ac6bdc78e7 | Augie Fackler | Nov 6 2019, 3:12 PM |
Status | Author | Revision | |
---|---|---|---|
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 | ||
Closed | durin42 |
env.update((k, py2shell(v)) for k, v in pycompat.iteritems(environ)) | env.update((k, py2shell(v)) for k, v in pycompat.iteritems(environ)) | ||||
env[b'HG'] = hgexecutable() | env[b'HG'] = hgexecutable() | ||||
return env | return env | ||||
if pycompat.iswindows: | if pycompat.iswindows: | ||||
def shelltonative(cmd, env): | def shelltonative(cmd, env): | ||||
return platform.shelltocmdexe(cmd, shellenviron(env)) | return platform.shelltocmdexe( # pytype: disable=module-attr | ||||
cmd, shellenviron(env) | |||||
) | |||||
tonativestr = encoding.strfromlocal | tonativestr = encoding.strfromlocal | ||||
else: | else: | ||||
def shelltonative(cmd, env): | def shelltonative(cmd, env): | ||||
return cmd | return cmd | ||||
tonativestr = pycompat.identity | tonativestr = pycompat.identity | ||||
if pycompat.iswindows: | if pycompat.iswindows: | ||||
# no fork on Windows, but we can create a detached process | # no fork on Windows, but we can create a detached process | ||||
# https://msdn.microsoft.com/en-us/library/windows/desktop/ms684863.aspx | # https://msdn.microsoft.com/en-us/library/windows/desktop/ms684863.aspx | ||||
# No stdlib constant exists for this value | # No stdlib constant exists for this value | ||||
DETACHED_PROCESS = 0x00000008 | DETACHED_PROCESS = 0x00000008 | ||||
# Following creation flags might create a console GUI window. | # Following creation flags might create a console GUI window. | ||||
# Using subprocess.CREATE_NEW_CONSOLE might helps. | # Using subprocess.CREATE_NEW_CONSOLE might helps. | ||||
# See https://phab.mercurial-scm.org/D1701 for discussion | # See https://phab.mercurial-scm.org/D1701 for discussion | ||||
_creationflags = DETACHED_PROCESS | subprocess.CREATE_NEW_PROCESS_GROUP | _creationflags = ( | ||||
DETACHED_PROCESS | |||||
| subprocess.CREATE_NEW_PROCESS_GROUP # pytype: disable=module-attr | |||||
) | |||||
def runbgcommand( | def runbgcommand( | ||||
script, env, shell=False, stdout=None, stderr=None, ensurestart=True | script, env, shell=False, stdout=None, stderr=None, ensurestart=True | ||||
): | ): | ||||
'''Spawn a command without waiting for it to finish.''' | '''Spawn a command without waiting for it to finish.''' | ||||
# we can't use close_fds *and* redirect stdin. I'm not sure that we | # we can't use close_fds *and* redirect stdin. I'm not sure that we | ||||
# need to because the detached process has no console connection. | # need to because the detached process has no console connection. | ||||
subprocess.Popen( | subprocess.Popen( |