diff options
Diffstat (limited to 'lib/System/Unix/Process.inc')
-rw-r--r-- | lib/System/Unix/Process.inc | 20 |
1 files changed, 7 insertions, 13 deletions
diff --git a/lib/System/Unix/Process.inc b/lib/System/Unix/Process.inc index 774783f..d715585 100644 --- a/lib/System/Unix/Process.inc +++ b/lib/System/Unix/Process.inc @@ -179,26 +179,20 @@ void Process::PreventCoreFiles() { } bool Process::StandardInIsUserInput() { -#if HAVE_ISATTY - return isatty(0); -#else - // If we don't have isatty, just return false. - return false; -#endif + return FileDescriptorIsDisplayed(STDIN_FILENO); } bool Process::StandardOutIsDisplayed() { -#if HAVE_ISATTY - return isatty(1); -#else - // If we don't have isatty, just return false. - return false; -#endif + return FileDescriptorIsDisplayed(STDOUT_FILENO); } bool Process::StandardErrIsDisplayed() { + return FileDescriptorIsDisplayed(STDERR_FILENO); +} + +bool Process::FileDescriptorIsDisplayed(int fd) { #if HAVE_ISATTY - return isatty(2); + return isatty(fd); #else // If we don't have isatty, just return false. return false; |