diff options
-rw-r--r-- | tools/perf/perf.c | 4 | ||||
-rw-r--r-- | tools/perf/util/cache.h | 4 | ||||
-rw-r--r-- | tools/perf/util/newt.c | 19 |
3 files changed, 17 insertions, 10 deletions
diff --git a/tools/perf/perf.c b/tools/perf/perf.c index d2de8393a33c..2826e702986e 100644 --- a/tools/perf/perf.c +++ b/tools/perf/perf.c | |||
@@ -264,11 +264,11 @@ static int run_builtin(struct cmd_struct *p, int argc, const char **argv) | |||
264 | set_debugfs_path(); | 264 | set_debugfs_path(); |
265 | 265 | ||
266 | status = p->fn(argc, argv, prefix); | 266 | status = p->fn(argc, argv, prefix); |
267 | exit_browser(status); | ||
268 | |||
267 | if (status) | 269 | if (status) |
268 | return status & 0xff; | 270 | return status & 0xff; |
269 | 271 | ||
270 | exit_browser(); | ||
271 | |||
272 | /* Somebody closed stdout? */ | 272 | /* Somebody closed stdout? */ |
273 | if (fstat(fileno(stdout), &st)) | 273 | if (fstat(fileno(stdout), &st)) |
274 | return 0; | 274 | return 0; |
diff --git a/tools/perf/util/cache.h b/tools/perf/util/cache.h index 47b12a3d11bf..4b9aab7f0405 100644 --- a/tools/perf/util/cache.h +++ b/tools/perf/util/cache.h | |||
@@ -77,10 +77,10 @@ static inline void setup_browser(void) | |||
77 | { | 77 | { |
78 | setup_pager(); | 78 | setup_pager(); |
79 | } | 79 | } |
80 | static inline void exit_browser(void) {} | 80 | static inline void exit_browser(bool wait_for_ok __used) {} |
81 | #else | 81 | #else |
82 | void setup_browser(void); | 82 | void setup_browser(void); |
83 | void exit_browser(void); | 83 | void exit_browser(bool wait_for_ok); |
84 | #endif | 84 | #endif |
85 | 85 | ||
86 | extern const char *editor_program; | 86 | extern const char *editor_program; |
diff --git a/tools/perf/util/newt.c b/tools/perf/util/newt.c index 2d19e7a3e6e8..3c2ef95d940a 100644 --- a/tools/perf/util/newt.c +++ b/tools/perf/util/newt.c | |||
@@ -170,18 +170,20 @@ void perf_session__browse_hists(struct rb_root *hists, u64 session_total, | |||
170 | newtFormDestroy(form); | 170 | newtFormDestroy(form); |
171 | } | 171 | } |
172 | 172 | ||
173 | static char browser__last_msg[1024]; | ||
174 | |||
173 | int browser__show_help(const char *format, va_list ap) | 175 | int browser__show_help(const char *format, va_list ap) |
174 | { | 176 | { |
175 | int ret; | 177 | int ret; |
176 | static int backlog; | 178 | static int backlog; |
177 | static char msg[1024]; | ||
178 | 179 | ||
179 | ret = vsnprintf(msg + backlog, sizeof(msg) - backlog, format, ap); | 180 | ret = vsnprintf(browser__last_msg + backlog, |
181 | sizeof(browser__last_msg) - backlog, format, ap); | ||
180 | backlog += ret; | 182 | backlog += ret; |
181 | 183 | ||
182 | if (msg[backlog - 1] == '\n') { | 184 | if (browser__last_msg[backlog - 1] == '\n') { |
183 | newtPopHelpLine(); | 185 | newtPopHelpLine(); |
184 | newtPushHelpLine(msg); | 186 | newtPushHelpLine(browser__last_msg); |
185 | newtRefresh(); | 187 | newtRefresh(); |
186 | backlog = 0; | 188 | backlog = 0; |
187 | } | 189 | } |
@@ -200,8 +202,13 @@ void setup_browser(void) | |||
200 | newtPushHelpLine(" "); | 202 | newtPushHelpLine(" "); |
201 | } | 203 | } |
202 | 204 | ||
203 | void exit_browser(void) | 205 | void exit_browser(bool wait_for_ok) |
204 | { | 206 | { |
205 | if (use_browser) | 207 | if (use_browser) { |
208 | if (wait_for_ok) { | ||
209 | char title[] = "Fatal Error", ok[] = "Ok"; | ||
210 | newtWinMessage(title, ok, browser__last_msg); | ||
211 | } | ||
206 | newtFinished(); | 212 | newtFinished(); |
213 | } | ||
207 | } | 214 | } |