Skip to content
Prev 12613 / 63461 Next

stdout == 'Terminal' or 'File' {was 'bad interaction ...'}

First, on an R console, stdout() is normally neither a `normal file' nor a 
`user terminal'.  Let alone under an embedded R ... or use under ESS
(where for you, Martin, it is neither).

On vanilla R under Unix-alikes (and Rterm but not otherwise) what stdout
is is a function of the C runtime system.  It's up to the C system if it
tells you what stdout has been redirected to, and if it can tell you
whether it is a terminal, or a pty (as used under some versions of Emacs) 
or a file or a socket ....  The information is at best unreliable.

interactive() is as good a test as we have, and I think if a better test 
is required in the interactive case, the user should be asked.
On Wed, 12 May 2004, Martin Maechler wrote: