D4816: logtoprocess: connect all fds to /dev/null to avoid bad interaction with pager
lothiraldan (Boris Feld)
phabricator at mercurial-scm.org
Mon Oct 1 07:42:09 EDT 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rHG030f40677db6: logtoprocess: connect all fds to /dev/null to avoid bad interaction with pager (authored by lothiraldan, committed by ).
REPOSITORY
rHG Mercurial
CHANGES SINCE LAST UPDATE
https://phab.mercurial-scm.org/D4816?vs=11508&id=11511
REVISION DETAIL
https://phab.mercurial-scm.org/D4816
AFFECTED FILES
hgext/logtoprocess.py
tests/test-logtoprocess.t
CHANGE DETAILS
diff --git a/tests/test-logtoprocess.t b/tests/test-logtoprocess.t
--- a/tests/test-logtoprocess.t
+++ b/tests/test-logtoprocess.t
@@ -121,4 +121,4 @@
$ touch $TESTTMP/wait-for-touched
$ sleep 0.2
$ test -f $TESTTMP/touched && echo "SUCCESS Pager is not waiting on ltp" || echo "FAIL Pager is waiting on ltp"
- FAIL Pager is waiting on ltp
+ SUCCESS Pager is not waiting on ltp
diff --git a/hgext/logtoprocess.py b/hgext/logtoprocess.py
--- a/hgext/logtoprocess.py
+++ b/hgext/logtoprocess.py
@@ -83,11 +83,16 @@
else:
newsession = {'start_new_session': True}
try:
- # connect stdin to devnull to make sure the subprocess can't
- # muck up that stream for mercurial.
+ # connect std* to devnull to make sure the subprocess can't
+ # muck up these stream for mercurial.
+ # Connect all the streams to be more close to Windows behavior
+ # and pager will wait for scripts to end if we don't do that
+ nullrfd = open(os.devnull, 'r')
+ nullwfd = open(os.devnull, 'w')
subprocess.Popen(
procutil.tonativestr(script),
- shell=True, stdin=open(os.devnull, 'r'),
+ shell=True, stdin=nullrfd,
+ stdout=nullwfd, stderr=nullwfd,
env=procutil.tonativeenv(env),
close_fds=True, **newsession)
finally:
To: lothiraldan, #hg-reviewers
Cc: mercurial-devel
More information about the Mercurial-devel
mailing list