1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-08-02 05:57:46 +00:00

Fix broken terminal in tests

This commit is contained in:
Arijit Dey 2021-05-18 12:42:33 +05:30
parent c930509095
commit 7a88df9fb4
No known key found for this signature in database
GPG key ID: 2F7AC644CE7E007D

View file

@ -133,8 +133,8 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
) )
.get_matches_from(args); .get_matches_from(args);
let mut buff = String::new(); let mut buff = String::new();
let mut stdout = setup_term();
if let Some(filenames) = matches.values_of(options::FILES) { if let Some(filenames) = matches.values_of(options::FILES) {
let mut stdout = setup_term();
let length = filenames.len(); let length = filenames.len();
for (idx, fname) in filenames.clone().enumerate() { for (idx, fname) in filenames.clone().enumerate() {
let fname = Path::new(fname); let fname = Path::new(fname);
@ -163,11 +163,11 @@ pub fn uumain(args: impl uucore::Args) -> i32 {
} }
reset_term(&mut stdout); reset_term(&mut stdout);
} else if atty::isnt(atty::Stream::Stdin) { } else if atty::isnt(atty::Stream::Stdin) {
let mut stdout = setup_term();
stdin().read_to_string(&mut buff).unwrap(); stdin().read_to_string(&mut buff).unwrap();
let mut stdout = setup_term();
more(&buff, &mut stdout, true); more(&buff, &mut stdout, true);
reset_term(&mut stdout);
} else { } else {
terminal::disable_raw_mode().unwrap();
show_usage_error!("bad usage"); show_usage_error!("bad usage");
} }
0 0