client: function to check if stdin is a tty
authorClinton Ebadi <clinton@unknownlamer.org>
Mon, 6 Oct 2014 03:13:06 +0000 (23:13 -0400)
committerClinton Ebadi <clinton@unknownlamer.org>
Mon, 6 Oct 2014 03:13:06 +0000 (23:13 -0400)
src/client.sig
src/client.sml

index 8cf8cd4..4b4b571 100644 (file)
@@ -24,6 +24,8 @@ signature CLIENT = sig
           | Aborted
           | Error
 
+    val hastty : unit -> bool
+
     val getpass : unit -> passwd_result
     (* Standard non-echoed console password input with confirmation *)
 end
index 0c4112f..a92b13f 100644 (file)
@@ -25,6 +25,9 @@ datatype passwd_result =
        | Aborted
        | Error
 
+fun hastty () =
+    Posix.ProcEnv.isatty Posix.FileSys.stdin
+
 fun getpass () =
     let
        val tty = Posix.FileSys.stdin