Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest nightly seems to cause issue with libc::isatty #2522

Closed
saghm opened this issue Mar 26, 2016 · 1 comment
Closed

Latest nightly seems to cause issue with libc::isatty #2522

saghm opened this issue Mar 26, 2016 · 1 comment

Comments

@saghm
Copy link
Contributor

saghm commented Mar 26, 2016

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!

@alexcrichton
Copy link
Member

I believe this is a dupe of rust-lang/rust#32254 caused by rust-lang/rust#31618 and fixed in rust-lang/rust#32257, so closing in favor of rust-lang/rust#32254 but thanks for the report!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants