[Updated] D11928: procutil: avoid an uninitialized variable usage on tempfile exception
mharbison72 (Matt Harbison)
phabricator at mercurial-scm.org
Fri Dec 17 11:12:18 UTC 2021
Closed by commit rHGf8540fe4be0f: procutil: avoid an uninitialized variable usage on tempfile exception (authored by mharbison72).
This revision was automatically updated to reflect the committed changes.
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D11928?vs=31493&id=31521
CHANGES SINCE LAST ACTION
https://phab.mercurial-scm.org/D11928/new/
REVISION DETAIL
https://phab.mercurial-scm.org/D11928
AFFECTED FILES
mercurial/utils/procutil.py
CHANGE DETAILS
diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py
--- a/mercurial/utils/procutil.py
+++ b/mercurial/utils/procutil.py
@@ -742,6 +742,8 @@
start_new_session = False
ensurestart = True
+ stdin = None
+
try:
if stdin_bytes is None:
stdin = subprocess.DEVNULL
@@ -770,7 +772,7 @@
record_wait(255)
raise
finally:
- if stdin_bytes is not None:
+ if stdin_bytes is not None and stdin is not None:
assert not isinstance(stdin, int)
stdin.close()
if not ensurestart:
@@ -852,6 +854,8 @@
return
returncode = 255
+ stdin = None
+
try:
if record_wait is None:
# Start a new session
@@ -894,7 +898,8 @@
finally:
# mission accomplished, this child needs to exit and not
# continue the hg process here.
- stdin.close()
+ if stdin is not None:
+ stdin.close()
if record_wait is None:
os._exit(returncode)
To: mharbison72, #hg-reviewers, Alphare
Cc: mercurial-patches
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mercurial-scm.org/pipermail/mercurial-patches/attachments/20211217/cae81307/attachment-0002.html>
More information about the Mercurial-patches
mailing list