Mercurial > hg
changeset 6339:ed9b07a97587
util: check fileno() validity in win32 set_binary()
author | Patrick Mezard <pmezard@gmail.com> |
---|---|
date | Fri, 21 Mar 2008 21:56:55 +0100 |
parents | 0750f11152fe |
children | 949e607ac544 |
files | mercurial/util.py |
diffstat | 1 files changed, 3 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/util.py Fri Mar 21 14:52:24 2008 +0100 +++ b/mercurial/util.py Fri Mar 21 21:56:55 2008 +0100 @@ -1000,7 +1000,9 @@ pass def set_binary(fd): - if hasattr(fd, 'fileno'): + # When run without console, pipes may expose invalid + # fileno(), usually set to -1. + if hasattr(fd, 'fileno') and fd.fileno() >= 0: msvcrt.setmode(fd.fileno(), os.O_BINARY) def pconvert(path):