mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
stty: fix output redirection (#8016)
* stty: fix output redirection * Revert "stty: fix output redirection" This reverts commit 604de7c4de6f51a6bcd495ccda11602c12804493. * stty: fix output redirection by trying /dev/tty before stdout
This commit is contained in:
parent
7b41a160b4
commit
dfc4072181
1 changed files with 12 additions and 1 deletions
|
@ -142,7 +142,18 @@ impl<'a> Options<'a> {
|
||||||
.custom_flags(O_NONBLOCK)
|
.custom_flags(O_NONBLOCK)
|
||||||
.open(f)?,
|
.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
|
settings: matches
|
||||||
.get_many::<String>(options::SETTINGS)
|
.get_many::<String>(options::SETTINGS)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue