diff --git a/mercurial/utils/procutil.py b/mercurial/utils/procutil.py --- a/mercurial/utils/procutil.py +++ b/mercurial/utils/procutil.py @@ -273,13 +273,13 @@ def protectstdio(uin, uout): """ 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') diff --git a/tests/test-ssh.t b/tests/test-ssh.t --- a/tests/test-ssh.t +++ b/tests/test-ssh.t @@ -328,6 +328,10 @@ try again with remote chg, which should 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]