-
-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Description
I have a program that reads from stdin only when isatty returns false
let input_stdin = !atty::is(atty::Stream::Stdin);
When running this from a cron it always returns true like if there were something in stdin but there is nothing.
use atty::Stream;
fn main() {
if atty::is(Stream::Stdout) {
println!("I'm a terminal");
} else {
println!("I'm not");
}
let input_stdin = !atty::is(atty::Stream::Stdin); // isatty returns false if there's something in stdin.
if input_stdin {
println!("stdin"); // how to prevent this to happen when calling it from a cron
}
}
Any idea how to prevent this so that I could call my app from a cron job and distinguish when there is something in stdin and not?
schneiderfelipe
Metadata
Metadata
Assignees
Labels
No labels