mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
perf newt: Properly restore the screen when error exiting
Show an OK message box with the last message sent via pr_err, etc. Reported-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Frédéric Weisbecker <fweisbec@gmail.com> Cc: Mike Galbraith <efault@gmx.de> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Paul Mackerras <paulus@samba.org> LKML-Reference: <1269274229-20442-1-git-send-email-acme@infradead.org> Signed-off-by: Ingo Molnar <mingo@elte.hu>
This commit is contained in:
parent
301fde27c7
commit
f3a1f0ea94
3 changed files with 17 additions and 10 deletions
|
@ -264,11 +264,11 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv)
|
||||||
set_debugfs_path();
|
set_debugfs_path();
|
||||||
|
|
||||||
status = p->fn(argc, argv, prefix);
|
status = p->fn(argc, argv, prefix);
|
||||||
|
exit_browser(status);
|
||||||
|
|
||||||
if (status)
|
if (status)
|
||||||
return status & 0xff;
|
return status & 0xff;
|
||||||
|
|
||||||
exit_browser();
|
|
||||||
|
|
||||||
/* Somebody closed stdout? */
|
/* Somebody closed stdout? */
|
||||||
if (fstat(fileno(stdout), &st))
|
if (fstat(fileno(stdout), &st))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -77,10 +77,10 @@ static inline void setup_browser(void)
|
||||||
{
|
{
|
||||||
setup_pager();
|
setup_pager();
|
||||||
}
|
}
|
||||||
static inline void exit_browser(void) {}
|
static inline void exit_browser(bool wait_for_ok __used) {}
|
||||||
#else
|
#else
|
||||||
void setup_browser(void);
|
void setup_browser(void);
|
||||||
void exit_browser(void);
|
void exit_browser(bool wait_for_ok);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern const char *editor_program;
|
extern const char *editor_program;
|
||||||
|
|
|
@ -170,18 +170,20 @@ void perf_session__browse_hists(struct rb_root *hists, u64 session_total,
|
||||||
newtFormDestroy(form);
|
newtFormDestroy(form);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char browser__last_msg[1024];
|
||||||
|
|
||||||
int browser__show_help(const char *format, va_list ap)
|
int browser__show_help(const char *format, va_list ap)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
static int backlog;
|
static int backlog;
|
||||||
static char msg[1024];
|
|
||||||
|
|
||||||
ret = vsnprintf(msg + backlog, sizeof(msg) - backlog, format, ap);
|
ret = vsnprintf(browser__last_msg + backlog,
|
||||||
|
sizeof(browser__last_msg) - backlog, format, ap);
|
||||||
backlog += ret;
|
backlog += ret;
|
||||||
|
|
||||||
if (msg[backlog - 1] == '\n') {
|
if (browser__last_msg[backlog - 1] == '\n') {
|
||||||
newtPopHelpLine();
|
newtPopHelpLine();
|
||||||
newtPushHelpLine(msg);
|
newtPushHelpLine(browser__last_msg);
|
||||||
newtRefresh();
|
newtRefresh();
|
||||||
backlog = 0;
|
backlog = 0;
|
||||||
}
|
}
|
||||||
|
@ -200,8 +202,13 @@ void setup_browser(void)
|
||||||
newtPushHelpLine(" ");
|
newtPushHelpLine(" ");
|
||||||
}
|
}
|
||||||
|
|
||||||
void exit_browser(void)
|
void exit_browser(bool wait_for_ok)
|
||||||
{
|
{
|
||||||
if (use_browser)
|
if (use_browser) {
|
||||||
|
if (wait_for_ok) {
|
||||||
|
char title[] = "Fatal Error", ok[] = "Ok";
|
||||||
|
newtWinMessage(title, ok, browser__last_msg);
|
||||||
|
}
|
||||||
newtFinished();
|
newtFinished();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue