mirror of
https://github.com/dankamongmen/notcurses.git
synced 2024-11-18 03:25:55 +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,
|
if(setup_signals(ret,
|
||||||
(opts->flags & NCOPTION_NO_QUIT_SIGHANDLERS),
|
(opts->flags & NCOPTION_NO_QUIT_SIGHANDLERS),
|
||||||
(opts->flags & NCOPTION_NO_WINCH_SIGHANDLER))){
|
(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;
|
int termerr;
|
||||||
if(setupterm(opts->termtype, ret->ttyfd, &termerr) != OK){
|
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
|
// 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
|
static void
|
||||||
reset_terminal(){
|
reset_terminal(){
|
||||||
int fd = open("/dev/tty", O_RDWR|O_CLOEXEC);
|
int fd = open("/dev/tty", O_RDWR|O_CLOEXEC);
|
||||||
@ -104,21 +104,14 @@ auto main(int argc, const char **argv) -> int {
|
|||||||
doctest::Context context;
|
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);
|
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);
|
dt_removed args(argv);
|
||||||
handle_opts(argv);
|
handle_opts(argv);
|
||||||
|
|
||||||
int res = context.run(); // run
|
int res = context.run(); // run
|
||||||
|
|
||||||
if(context.shouldExit()){ // important - query flags (and --exit) rely on the user doing this
|
if(context.shouldExit()){ // important - query flags (and --exit) rely on the user doing this
|
||||||
return res; // propagate the result of the tests
|
return res; // propagate the result of the tests
|
||||||
}
|
}
|
||||||
|
|
||||||
// if we exited via REQUIRE(), we likely left the terminal in an invalid
|
// if we exited via REQUIRE(), we likely left the terminal in an invalid
|
||||||
// state. go ahead and reset it manually.
|
// state. go ahead and reset it manually.
|
||||||
if(res){
|
if(res){
|
||||||
|
Loading…
Reference in New Issue
Block a user