exit cleanly when kompare is piped to another application and this pipe is closed
authorMarc Fiuczynski <mef@cs.princeton.edu>
Mon, 10 Sep 2007 17:05:16 +0000 (17:05 +0000)
committerMarc Fiuczynski <mef@cs.princeton.edu>
Mon, 10 Sep 2007 17:05:16 +0000 (17:05 +0000)
configs/kompare

index 3d6676f..9d58a94 100755 (executable)
@@ -5,7 +5,7 @@
 # Marc E. Fiuczynski <mef@cs.princeton.edu>
 # Copyright (C) 2006 The Trustees of Princeton University
 #
-# $Id: kompare,v 1.5 2006/12/14 05:08:53 mef Exp $
+# $Id: kompare,v 1.6 2006/12/14 19:59:05 mef Exp $
 #
 
 import sys, re, os
@@ -73,7 +73,12 @@ for key in keys:
     o = old.get(key,None)
     n = new[key]
     if n==o and not showall: continue
-    print "%6s -> %6s : %s" % (newstate.get(o,o),newstate.get(n,n),key)
+    try:
+       print "%6s -> %6s : %s" % (newstate.get(o,o),newstate.get(n,n),key)
+    except IOError, e:
+       #print e
+        sys.exit(0)
+
     seen[key] = None
 
 # not sure we care about what options have been removed
@@ -85,4 +90,8 @@ for key in keys:
     n = new.get(key,None)
     o = old[key]
     if n == o and not showall: continue
-    print "%6s -> %6s : %s" % (oldstate.get(o,o),oldstate.get(n,n),key)
+    try:
+       print "%6s -> %6s : %s" % (oldstate.get(o,o),oldstate.get(n,n),key)
+    except IOError, e:
+       #print e
+        sys.exit(0)