Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.8.1, 0.8.2, and 0.8.3

hgtk: keep pointer to our cStringIO instance

If the launched application overrides sys.stderr itself, we may
crash when we try to call seek() on it. So keep a pointer to
the cStringIO.StringIO instance we allocated and use it directly.

Fixes tracebacks from launching Qct as external commit tool

Changeset 9b454cc286e1

Parent 8fccf0215997

by Steve Borho

Changes to one file · Browse files at 9b454cc286e1 Showing diff from parent 8fccf0215997 Diff from another changeset...

Change 1 of 1 Show Entire File hgtk Stacked
 
43
44
45
46
 
 
47
48
49
 
 
50
51
52
53
54
55
 
 
56
57
58
 
43
44
45
 
46
47
48
 
 
49
50
51
52
53
54
 
 
55
56
57
58
59
@@ -43,16 +43,17 @@
  sys.exit(hggtk.hgtk.dispatch(sys.argv[1:]))  else:   import cStringIO - sys.stderr = cStringIO.StringIO() + mystderr = cStringIO.StringIO() + sys.stderr = mystderr   ret = hggtk.hgtk.dispatch(sys.argv[1:]) - sys.stderr.seek(0) - for l in sys.stderr.readlines(): + mystderr.seek(0) + for l in mystderr.readlines():   if l.startswith('Traceback') or l.startswith('TypeError'):   from hggtk.bugreport import run   from hggtk.hgtk import gtkrun   from mercurial import ui - sys.stderr.seek(0) - error = 'Recoverable runtime error (stderr):\n' + sys.stderr.read() + mystderr.seek(0) + error = 'Recoverable runtime error (stderr):\n' + mystderr.read()   opts = {}   opts['cmd'] = ' '.join(sys.argv[1:])   opts['error'] = error