Mercurial > hg
changeset 39807:e5724be689b3 stable
procutil: compare fd number to see if stdio protection is needed (issue5992)
When I wrote this function for commandserver at 69f86b937035, testing object
identity was suffice, and I was sloppy enough not to compare fileno() values.
However, it doesn't work in chg session because chgserver reopens stdio to
apply new buffering mode.
This patch partially fixes the issue 5992. Still we have another problem in
chgui._runsystem().
author | Yuya Nishihara <yuya@tcha.org> |
---|---|
date | Wed, 26 Sep 2018 20:53:59 +0900 |
parents | 0ad5f064d829 |
children | 1b9be0b26511 |
files | mercurial/utils/procutil.py tests/test-ssh.t |
diffstat | 2 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/utils/procutil.py Tue Sep 25 23:06:02 2018 +0900 +++ b/mercurial/utils/procutil.py Wed Sep 26 20:53:59 2018 +0900 @@ -273,13 +273,13 @@ """ uout.flush() fin, fout = uin, uout - if uin is stdin: + if _testfileno(uin, stdin): newfd = os.dup(uin.fileno()) nullfd = os.open(os.devnull, os.O_RDONLY) os.dup2(nullfd, uin.fileno()) os.close(nullfd) fin = os.fdopen(newfd, r'rb') - if uout is stdout: + if _testfileno(uout, stdout): newfd = os.dup(uout.fileno()) os.dup2(stderr.fileno(), uout.fileno()) fout = os.fdopen(newfd, r'wb')
--- a/tests/test-ssh.t Tue Sep 25 23:06:02 2018 +0900 +++ b/tests/test-ssh.t Wed Sep 26 20:53:59 2018 +0900 @@ -328,6 +328,10 @@ pushing to ssh://user@dummy/remote searching for changes remote has heads on branch 'default' that are not known locally: 6c0482d977a3 + remote: adding changesets + remote: adding manifests + remote: adding file changes + remote: added 1 changesets with 1 changes to 1 files abort: not a Mercurial bundle [255]