mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-02 09:40:15 +00:00
notcurses_init: don't treat setup_signals as fatal error #1168
This commit is contained in:
parent
186b3a2a5e
commit
2c85142b2a
@ -1061,7 +1061,8 @@ notcurses* notcurses_init(const notcurses_options* opts, FILE* outfp){
|
||||
if(setup_signals(ret,
|
||||
(opts->flags & NCOPTION_NO_QUIT_SIGHANDLERS),
|
||||
(opts->flags & NCOPTION_NO_WINCH_SIGHANDLER))){
|
||||
goto err;
|
||||
// don't treat failure here as an error. it screws up unit tests, and one
|
||||
// day we'll need support multiple notcurses contexts. FIXME
|
||||
}
|
||||
int termerr;
|
||||
if(setupterm(opts->termtype, ret->ttyfd, &termerr) != OK){
|
||||
|
@ -43,7 +43,7 @@ handle_opts(const char** argv){
|
||||
}
|
||||
|
||||
// reset the terminal in the event of early exit (notcurses_init() presumably
|
||||
// ran, but we don't have the notcurses struct to destroy. so just do it raw.
|
||||
// ran, but we don't have the notcurses struct to destroy, so just do it raw).
|
||||
static void
|
||||
reset_terminal(){
|
||||
int fd = open("/dev/tty", O_RDWR|O_CLOEXEC);
|
||||
@ -103,22 +103,15 @@ auto main(int argc, const char **argv) -> int {
|
||||
std::cout << "Running with TERM=" << term << std::endl;
|
||||
doctest::Context context;
|
||||
|
||||
context.setOption("order-by", "name"); // sort the test cases by their name
|
||||
|
||||
context.setOption("order-by", "name"); // sort the test cases by their name
|
||||
context.applyCommandLine(argc, argv);
|
||||
|
||||
// overrides
|
||||
context.setOption("no-breaks", true); // don't break in the debugger when assertions fail
|
||||
|
||||
context.setOption("no-breaks", true); // don't break in the debugger when assertions fail
|
||||
dt_removed args(argv);
|
||||
handle_opts(argv);
|
||||
|
||||
int res = context.run(); // run
|
||||
|
||||
if(context.shouldExit()){ // important - query flags (and --exit) rely on the user doing this
|
||||
return res; // propagate the result of the tests
|
||||
}
|
||||
|
||||
// if we exited via REQUIRE(), we likely left the terminal in an invalid
|
||||
// state. go ahead and reset it manually.
|
||||
if(res){
|
||||
|
Loading…
Reference in New Issue
Block a user