summaryrefslogtreecommitdiffstats
path: root/llvm/lib/System/Unix/Process.cpp
diff options
context:
space:
mode:
authorReid Spencer <rspencer@reidspencer.com>2005-01-01 22:29:26 +0000
committerReid Spencer <rspencer@reidspencer.com>2005-01-01 22:29:26 +0000
commit6f802ba8765bad76847e3e4b5bf88bed7fc6ab97 (patch)
treeee211494d1f3a4684b1dba80ca67ec3af4a44af7 /llvm/lib/System/Unix/Process.cpp
parentca7d19e2afcde9725422e832f4bf55bf61ab0903 (diff)
downloadbcm5719-llvm-6f802ba8765bad76847e3e4b5bf88bed7fc6ab97.tar.gz
bcm5719-llvm-6f802ba8765bad76847e3e4b5bf88bed7fc6ab97.zip
Add functions for determining if the stdin/out/err is connected to a
console or not. llvm-svn: 19233
Diffstat (limited to 'llvm/lib/System/Unix/Process.cpp')
-rw-r--r--llvm/lib/System/Unix/Process.cpp24
1 files changed, 24 insertions, 0 deletions
diff --git a/llvm/lib/System/Unix/Process.cpp b/llvm/lib/System/Unix/Process.cpp
index c1448de8d40..cccd3ffcb67 100644
--- a/llvm/lib/System/Unix/Process.cpp
+++ b/llvm/lib/System/Unix/Process.cpp
@@ -122,5 +122,29 @@ void Process::PreventCoreFiles() {
#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
OpenPOWER on IntegriCloud