Skip to content

Commit

Permalink
get rid of a warning when using newterm
Browse files Browse the repository at this point in the history
newterm https://github.com/jeaye/ncurses-rs/blob/3aa22bc279e4929e3ab69d49f75a18eda3e431e9/src/lib.rs#L1023-L1029
CString::new https://doc.rust-lang.org/std/ffi/struct.CString.html#method.new

bubble up this newterm error

as suggested here: gyscos#778 (comment)

Co-authored-by: Alexandre Bury <alexandre.bury@gmail.com>

preserve original error in the panic report

otherwise, we'd not know why ncurses-rs newterm errored

directly include the variable name in the format! expression

as suggested here: gyscos#778 (comment)

Co-authored-by: Alexandre Bury <alexandre.bury@gmail.com>
  • Loading branch information
correabuscar and gyscos committed Jun 6, 2024
1 parent de8db96 commit 8b2645d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion cursive/src/backends/curses/n.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,10 @@ impl Backend {
let path = CString::new(output_path).unwrap();
unsafe { libc::fopen(path.as_ptr(), mode.as_ptr()) }
};
ncurses::newterm(None, output, input);
ncurses::newterm(None, output, input).map_err(|e| {
io::Error::new(io::ErrorKind::Other, format!("could not call newterm: {e}"))
})?;

// Enable keypad (like arrows)
ncurses::keypad(ncurses::stdscr(), true);

Expand Down

0 comments on commit 8b2645d

Please sign in to comment.