mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
stty: fix output redirection (#8016)
* stty: fix output redirection
* Revert "stty: fix output redirection"
This reverts commit 604de7c4de.
* stty: fix output redirection by trying /dev/tty before stdout
This commit is contained in:
+12
-1
@@ -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::<String>(options::SETTINGS)
|
||||
|
||||
Reference in New Issue
Block a user