try-error in batch and interactive mode (PR#1934)
Prof Brian D Ripley
ripley@stats.ox.ac.uk
Sun, 25 Aug 2002 10:49:01 +0100 (BST)
This is caused by the call to
fflush(stdin)
in Rstd_FlushConsole() in src/unix/sys-std.c. I've commented on that
before: fflush on an input stream is not defined on the Solaris help page,
and it appears to flush piped input.
I've removed the call. If anyone knows what it was intended to accomplish,
please find another way to do it.
On Fri, 23 Aug 2002 jyan@stat.wisc.edu wrote:
> I have a tiny R script performing two tasks, the first one of which may
> contain error.
>
> mammon(12)% cat z.R
> version
> options(show.error.messages = FALSE)
> try(b <- log("foo")) ## task 1
> 1 + 2 ## task 2
>
> Running in batch mode from a solaries machine, the second task never got
> started; see below:
>
> mammon(13)% R BATCH --vanilla -q z.R
> mammon(14)% cat z.Rout
> > invisible(options(echo = TRUE))
> > version
> _
> platform sparc-sun-solaris2.8
> arch sparc
> os solaris2.8
> system sparc, solaris2.8
> status
> major 1
> minor 5.1
> year 2002
> month 06
> day 17
> language R
> > options(show.error.messages = FALSE)
> > try(b <- log("foo"))
> >
>
> The second task does start if run on a linux machine.
>
> ludwig(22)% cat z.Rout
> > invisible(options(echo = TRUE))
> > version
> _
> platform i686-pc-linux-gnu
> arch i686
> os linux-gnu
> system i686, linux-gnu
> status
> major 1
> minor 5.1
> year 2002
> month 06
> day 17
> language R
> > options(show.error.messages = FALSE)
> > try(b <- log("foo"))
> > 1 + 2
> [1] 3
> > proc.time()
> [1] 0.87 0.07 0.90 0.00 0.00
> >
>
> The same code works well if pasted into an interactive R window on both
> system, of course.
>
> Jun Yan
>
> Department of Statistics Office: CSSC 4252
> university of Wisconsin-Madison Tel: (608)262-7478
> 1210 W. Dayton St. Email: jyan@stat.wisc.edu
> Madison, WI 53706 URL: http://www.stat.wisc.edu/~jyan
>
>
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
>
--
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._