Skip to content

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

Closed
@saghm

Description

@saghm

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions