@@ -342,7 +342,7 @@ pub(crate) fn read_single_key(ctrlc_key: bool) -> io::Result<Key> {
342
342
c_result ( || unsafe { libc:: tcgetattr ( input. as_raw_fd ( ) , termios. as_mut_ptr ( ) ) } ) ?;
343
343
let mut termios = unsafe { termios. assume_init ( ) } ;
344
344
let original = termios;
345
- unsafe { libc :: cfmakeraw ( & mut termios) } ;
345
+ make_raw ( & mut termios) ;
346
346
termios. c_oflag = original. c_oflag ;
347
347
c_result ( || unsafe { libc:: tcsetattr ( input. as_raw_fd ( ) , libc:: TCSADRAIN , & termios) } ) ?;
348
348
let rv = read_single_key_impl ( input. as_raw_fd ( ) ) ;
@@ -392,3 +392,27 @@ pub(crate) fn wants_emoji() -> bool {
392
392
pub ( crate ) fn set_title < T : Display > ( title : T ) {
393
393
print ! ( "\x1b ]0;{title}\x07 " ) ;
394
394
}
395
+
396
+ #[ cfg( target_os = "nto" ) ]
397
+ fn make_raw ( termios : & mut libc:: termios ) {
398
+ // This is the manual implementation for QNX, which does not have cfmakeraw.
399
+ termios. c_iflag &= !( libc:: IGNBRK
400
+ | libc:: BRKINT
401
+ | libc:: PARMRK
402
+ | libc:: ISTRIP
403
+ | libc:: INLCR
404
+ | libc:: IGNCR
405
+ | libc:: ICRNL
406
+ | libc:: IXON ) ;
407
+ termios. c_oflag &= !libc:: OPOST ;
408
+ termios. c_lflag &= !( libc:: ECHO | libc:: ECHONL | libc:: ICANON | libc:: ISIG | libc:: IEXTEN ) ;
409
+ termios. c_cflag &= !( libc:: CSIZE | libc:: PARENB ) ;
410
+ termios. c_cflag |= libc:: CS8 ;
411
+ }
412
+
413
+ // This version will be compiled for all targets that are NOT QNX.
414
+ #[ cfg( not( target_os = "nto" ) ) ]
415
+ fn make_raw ( termios : & mut libc:: termios ) {
416
+ // For other systems (Linux, macOS, BSD, etc.), use the standard libc call.
417
+ unsafe { libc:: cfmakeraw ( termios) } ;
418
+ }
0 commit comments