[meld] Redirect stdout/err to null on pythonw to fix crash (closes bgo#688466)
- From: Kai Willadsen <kaiw src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [meld] Redirect stdout/err to null on pythonw to fix crash (closes bgo#688466)
- Date: Sun, 18 Nov 2012 19:11:38 +0000 (UTC)
commit c8e32f072e3a75132826b9ef52c2e51461f26e12
Author: Felix Krull <f_krull gmx de>
Date: Sat Nov 17 17:37:37 2012 +0100
Redirect stdout/err to null on pythonw to fix crash (closes bgo#688466)
bin/meld | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/bin/meld b/bin/meld
index a695437..ce67b7f 100755
--- a/bin/meld
+++ b/bin/meld
@@ -21,6 +21,15 @@ import locale
import os
import sys
+# On Windows, pythonw.exe (which doesn't display a console window) supplies
+# dummy stdout and stderr streams that silently throw away any output. However,
+# these streams seem to have issues with flush() so we just redirect stdout and
+# stderr to actual dummy files (the equivalent of /dev/null).
+# Regarding pythonw.exe stdout, see also http://bugs.python.org/issue706263
+if sys.executable.endswith("pythonw.exe"):
+ devnull = open(os.devnull, "w")
+ sys.stdout = sys.stderr = devnull
+
# Disable buffering of stdout
class Unbuffered(object):
def __init__(self, file):
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]