Expand/Shrink

isatty

Definition: bool res = isatty(integer fn)
Description: Check whether stdin/stdout/stderr have been redirected.

fn: 0/1/2 for stdin/stdout/stderr respectively.

Returns true if the specified device is connected to a terminal, false if it has been redirected.
pwa/p2js: Not supported
Comments: You may, for instance, wish to output much more detailed results to a file than the console, or use a much less human-readable format when the recipient is likely to be another program.
Example:
printf(1,"stdin:%t, stdout:%t, stderr:%t\n",{isatty(0),isatty(1),isatty(2)})
--
-- p test                               ==> stdin:true, stdout:true, stderr:true
--
-- echo hello | p test                  ==> stdin:false, stdout:true, stderr:true
--
-- p test > test.txt; type test.txt     ==> stdin:true, stdout:false, stderr:true
--
-- p test 2> test.txt                   ==> stdin:true, stdout:true, stderr:false
Implementation: See builtins\isatty.e (an autoinclude) for details of the actual implementation.
Expand/Shrink