diff --git a/src/uu/stty/src/stty.rs b/src/uu/stty/src/stty.rs index 5cc24a596..4e2ceaa3f 100644 --- a/src/uu/stty/src/stty.rs +++ b/src/uu/stty/src/stty.rs @@ -142,7 +142,18 @@ impl<'a> Options<'a> { .custom_flags(O_NONBLOCK) .open(f)?, ), - None => Device::Stdout(stdout()), + // default to /dev/tty, if that does not exist then default to stdout + None => { + if let Ok(f) = std::fs::OpenOptions::new() + .read(true) + .custom_flags(O_NONBLOCK) + .open("/dev/tty") + { + Device::File(f) + } else { + Device::Stdout(stdout()) + } + } }, settings: matches .get_many::(options::SETTINGS)