dev.print + impossible filename -> break (PR#1959)
Prof Brian D Ripley
ripley@stats.ox.ac.uk
Wed, 28 Aug 2002 14:53:55 +0100 (BST)
On Wed, 28 Aug 2002 ripley@stats.ox.ac.uk wrote:
> Here's the nub.
>
> > postscript(file="|llllll")
> > sh: llllll: command not found
>
> > dev.off()
> Broken pipe
>
> and it's related to how popen/pclose are implemented. The help page
> does say errors are hard to detect, but we can do a bit better than this.
What I tested was checking errno, which the man page says gets set.
But on Linux I find:
popen succeeds, returns a valid file handle and does not set errno.
pclose on that file handle terminates the process.
The last can be avoided by setting a signal handler for SIGPIPE,
although that's not portable across OSes.
Anyone know a portable way to do this?
--
Brian D. Ripley, ripley@stats.ox.ac.uk
Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel: +44 1865 272861 (self)
1 South Parks Road, +44 1865 272860 (secr)
Oxford OX1 3TG, UK Fax: +44 1865 272595
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._