summaryrefslogtreecommitdiff
path: root/git_crecord
diff options
context:
space:
mode:
authorLaurent Charignon <lcharignon@fb.com>2015-07-17 13:41:17 -0700
committerAndrej Shadura <andrew@shadura.me>2018-07-03 19:35:06 +0200
commit774efb76e34cd73cac880cc8cd4f3370279dcb32 (patch)
treed3242d190f2bd2aa3e4ed087b4b73ab9a2d4c0db /git_crecord
parent30fcc67a1a2a0686c2776f51a6faae2f541f7d45 (diff)
chunk_selector: add error reporting for failure in curses interface initialization
Before this patch, we couldn't report to the user any error that occurred: - after we enabled the curses interface but - before the interface is set up and drawn This patch, provides a way to set errors that happens during the initialization of the interface and log them once the curses interface has been displayed.
Diffstat (limited to 'git_crecord')
-rw-r--r--git_crecord/chunk_selector.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/git_crecord/chunk_selector.py b/git_crecord/chunk_selector.py
index 9462069..aa221a8 100644
--- a/git_crecord/chunk_selector.py
+++ b/git_crecord/chunk_selector.py
@@ -58,6 +58,8 @@ def chunkselector(opts, headerlist, ui):
chunkselector = CursesChunkSelector(headerlist, ui)
f = signal.getsignal(signal.SIGTSTP)
curses.wrapper(chunkselector.main, opts)
+ if chunkselector.initerr is not None:
+ raise util.Abort(chunkselector.initerr)
# ncurses does not restore signal handler for SIGTSTP
signal.signal(signal.SIGTSTP, f)
@@ -1072,6 +1074,9 @@ Are you sure you want to review/edit and confirm the selected changes [yN]?
origsigwinchhandler = signal.signal(signal.SIGWINCH,
self.sigwinchhandler)
self.stdscr = stdscr
+ # error during initialization, cannot be printed in the curses
+ # interface, it should be printed by the calling code
+ self.initerr = None
self.yscreensize, self.xscreensize = self.stdscr.getmaxyx()
curses.start_color()