Mercurial > public > mercurial-scm > hg
comparison mercurial/util.py @ 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 | 4e836769d93c |
children | ac0bcd951c2c 08d9e0f974d9 |
comparison
equal
deleted
inserted
replaced
6338:0750f11152fe | 6339:ed9b07a97587 |
---|---|
998 | 998 |
999 def set_flags(f, flags): | 999 def set_flags(f, flags): |
1000 pass | 1000 pass |
1001 | 1001 |
1002 def set_binary(fd): | 1002 def set_binary(fd): |
1003 if hasattr(fd, 'fileno'): | 1003 # When run without console, pipes may expose invalid |
1004 # fileno(), usually set to -1. | |
1005 if hasattr(fd, 'fileno') and fd.fileno() >= 0: | |
1004 msvcrt.setmode(fd.fileno(), os.O_BINARY) | 1006 msvcrt.setmode(fd.fileno(), os.O_BINARY) |
1005 | 1007 |
1006 def pconvert(path): | 1008 def pconvert(path): |
1007 return '/'.join(splitpath(path)) | 1009 return '/'.join(splitpath(path)) |
1008 | 1010 |