Copilot commented on code in PR #13733:
URL: https://github.com/apache/trafficserver/pull/13733#discussion_r4107158424
##########
src/traffic_top/traffic_top.cc:
##########
@@ -494,4 +497,10 @@ main([[maybe_unused]] int argc, const char **argv)
endwin();
return 0;
+} catch (std::exception const &ex) {
+ fprintf(stderr, "traffic_top: terminating on an unhandled exception: %s\n",
ex.what());
+ return 1;
+} catch (...) {
+ fprintf(stderr, "traffic_top: terminating on an unhandled exception\n");
+ return 1;
Review Comment:
If an exception is raised after `initscr()` succeeds, this handler returns
without calling `endwin()`; the only cleanup is the normal-path call at line
497. That leaves the user's terminal in curses/raw mode after `traffic_top`
exits. Track whether curses was initialized and restore it in both exception
handlers (or use an equivalent scope guard) before returning.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]