Description
The behavior of libc::isatty()
seems to depend on whether cargo run
is used (as opposed to just running the binary in target
in the latest nightly (2016-03-24). For example, with the following code:
fn main() {
let fileno = unsafe { libc::STDIN_FILENO as i32 };
let isatty = unsafe { libc::isatty(fileno) };
println!("fileno: {}, isatty: {}", fileno, isatty);
}
When run with the 2016-03-23 nightly, it prints out fileno: 0, isatty: 1
(whether run with cargo run
or directly from the binary). However, with the 2016-03-24 nightly, it prints out fileno: 0, isatty: 1
when run directly from the binary and fileno: 0, isatty: 0
when run with cargo run
. This leads me to believe that the difference might be caused by some change in cargo in dealing with standard input. Obviously a workaround is just not to use cargo run
, but I'm curious about whether the previous behavior might be worth restoring at some point in the future.
I tried to look through the recent commits to see if I could track down where the change occurred, but unfortunately had no luck. Sorry about not being able to point somewhere specific in the code!