#![feature(libc)]
extern crate libc;

pub fn readline() -> Option<String> {
    // Buffer to hold readline input
    let buffer = String::new();

    let isatty = unsafe { libc::isatty(libc::STDIN_FILENO as i32) } != 0; 
    if isatty  {
        println!("stdin is a tty");
    } else {
        println!("stdin is not a tty");
    }

    buffer
}

#[test]
fn it_works() {
}

--- 
+++ 
@@ -1,3 +1,16 @@
-#[test]
-fn it_works() {
+#![feature(libc)]
+extern crate libc;
+
+pub fn readline() -> Option<String> {
+    // Buffer to hold readline input
+    let buffer = String::new();
+
+    let isatty = unsafe { libc::isatty(libc::STDIN_FILENO as i32) } != 0; 
+    if isatty  {
+        println!("stdin is a tty");
+    } else {
+        println!("stdin is not a tty");
+    }
+
+    buffer
 }
Check if stdin is from a tty
