Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 4 additions & 5 deletions src/uu/stty/src/stty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,7 @@ fn stty(opts: &Options) -> UResult<()> {
}

// TODO: Figure out the right error message for when tcgetattr fails
let mut termios = tcgetattr(opts.file.as_fd()).expect("Could not get terminal attributes");
let mut termios = tcgetattr(opts.file.as_fd())?;

// iterate over valid_args, match on the arg type, do the matching apply function
for arg in &valid_args {
Expand All @@ -419,12 +419,11 @@ fn stty(opts: &Options) -> UResult<()> {
}
}
}
tcsetattr(opts.file.as_fd(), set_arg, &termios)
.expect("Could not write terminal attributes");
tcsetattr(opts.file.as_fd(), set_arg, &termios)?;
} else {
// TODO: Figure out the right error message for when tcgetattr fails
let termios = tcgetattr(opts.file.as_fd()).expect("Could not get terminal attributes");
print_settings(&termios, opts).expect("TODO: make proper error here from nix error");
let termios = tcgetattr(opts.file.as_fd())?;
print_settings(&termios, opts)?;
}
Ok(())
}
Expand Down
Loading