From: david-sarah Date: Wed, 27 Oct 2010 02:16:36 +0000 (-0700) Subject: windows/fixups.py: limit length of string passed in a single call to WriteConsoleW... X-Git-Tag: trac-4800~29 X-Git-Url: https://git.rkrishnan.org/about.html?a=commitdiff_plain;h=25d8103dde95d78450ca52a6c327f525d3f6af4c;p=tahoe-lafs%2Ftahoe-lafs.git windows/fixups.py: limit length of string passed in a single call to WriteConsoleW. fixes #1232. --- diff --git a/src/allmydata/windows/fixups.py b/src/allmydata/windows/fixups.py index ce8af4b2..12c725bc 100644 --- a/src/allmydata/windows/fixups.py +++ b/src/allmydata/windows/fixups.py @@ -129,7 +129,9 @@ def initialize(): remaining = len(text) while remaining > 0: n = DWORD(0) - retval = WriteConsoleW(self._hConsole, text, remaining, byref(n), None) + # There is a shorter-than-documented limitation on the length of the string + # passed to WriteConsoleW (see #1232). + retval = WriteConsoleW(self._hConsole, text, min(remaining, 10000), byref(n), None) if retval == 0 or n.value == 0: raise IOError("WriteConsoleW returned %r, n.value = %r" % (retval, n.value)) remaining -= n.value