mercurial/cmdutil.py
changeset 13121 bf763946f8b0
parent 13081 79184986658c
child 13386 f78bc5ddbe4f
--- a/mercurial/cmdutil.py	Fri Dec 10 19:20:11 2010 -0600
+++ b/mercurial/cmdutil.py	Tue Dec 07 16:08:16 2010 +0100
@@ -233,7 +233,8 @@
     writable = 'w' in mode or 'a' in mode
 
     if not pat or pat == '-':
-        return writable and sys.stdout or sys.stdin
+        fp = writable and sys.stdout or sys.stdin
+        return os.fdopen(os.dup(fp.fileno()), mode)
     if hasattr(pat, 'write') and writable:
         return pat
     if hasattr(pat, 'read') and 'r' in mode: