Add functions for determining if the stdin/out/err is connected to a
console or not.
llvm-svn: 19233
diff --git a/llvm/lib/System/Unix/Process.cpp b/llvm/lib/System/Unix/Process.cpp
index c1448de..cccd3ff 100644
--- a/llvm/lib/System/Unix/Process.cpp
+++ b/llvm/lib/System/Unix/Process.cpp
@@ -122,5 +122,29 @@
#endif
}
+bool Process::StandardInIsUserInput() {
+#if HAVE_ISATTY
+ return isatty(0);
+#endif
+ // If we don't have isatty, just return false.
+ return false;
+}
+
+bool Process::StandardOutIsDisplayed() {
+#if HAVE_ISATTY
+ return isatty(1);
+#endif
+ // If we don't have isatty, just return false.
+ return false;
+}
+
+bool Process::StandardErrIsDisplayed() {
+#if HAVE_ISATTY
+ return isatty(2);
+#endif
+ // If we don't have isatty, just return false.
+ return false;
+}
+
}
// vim: sw=2 smartindent smarttab tw=80 autoindent expandtab