Skip to content

Commit c02de5b

Browse files
correabuscargyscos
andcommitted
get rid of a warning when using newterm
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: #778 (comment) Co-authored-by: Alexandre Bury <[email protected]> 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: #778 (comment) Co-authored-by: Alexandre Bury <[email protected]>
1 parent d4247f8 commit c02de5b

File tree

1 file changed

+4
-1
lines changed
  • cursive/src/backends/curses

1 file changed

+4
-1
lines changed

cursive/src/backends/curses/n.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,10 @@ impl Backend {
110110
let path = CString::new(output_path).unwrap();
111111
unsafe { libc::fopen(path.as_ptr(), mode.as_ptr()) }
112112
};
113-
ncurses::newterm(None, output, input);
113+
ncurses::newterm(None, output, input).map_err(|e| {
114+
io::Error::new(io::ErrorKind::Other, format!("could not call newterm: {e}"))
115+
})?;
116+
114117
// Enable keypad (like arrows)
115118
ncurses::keypad(ncurses::stdscr(), true);
116119

0 commit comments

Comments
 (0)