russell-lenth at uiowa.edu
2006-Oct-13 21:29 UTC
[Rd] No exit codes from RTerm (Windows) (PR#9296)
Full_Name: Russell V. Lenth
Version: 2.3.1
OS: Windows XP Pro
Submission from: (NULL) (128.255.132.188)
I wrote a simple .BAT file to run the Sweave function on a file (via RTerm),
then run pdflatex on the result (after RTerm exits). The issue is that if an
error condition occurs in RTerm, it is prudent to not do the pdflatex processing
afterward.
Here are the relevant statements in the BAT script:
echo Sweave("%1",style=F,eps=F) | Rterm --no-save --no-restore
if not errorlevel == 0 goto end
The problem is that the errorlevel seems to always be 0, even if an error
occurs. I have a similar shell script for our linux system, and it works
correctly. Are there no provisions for RTerm to return an exit code in Windows?
It would be very useful to me if it would return a nonzero exit code when there
is an error.
Gabor Grothendieck
2006-Oct-13 21:40 UTC
[Rd] No exit codes from RTerm (Windows) (PR#9296)
I have an XP batch file that runs sweave and figures out whether to proceed
by comparing the file dates on the .Rnw and .tex files (and also on the
.tex and .pdf files). It will be included in the next version of the
batchfiles project:
http://cran.r-project.org/contrib/extra/batchfiles/
hopefully to be released this weekend or shortly. I will contact you
offline if in case you would like to test it.
On 10/13/06, russell-lenth at uiowa.edu <russell-lenth at uiowa.edu>
wrote:> Full_Name: Russell V. Lenth
> Version: 2.3.1
> OS: Windows XP Pro
> Submission from: (NULL) (128.255.132.188)
>
>
> I wrote a simple .BAT file to run the Sweave function on a file (via
RTerm),
> then run pdflatex on the result (after RTerm exits). The issue is that if
an
> error condition occurs in RTerm, it is prudent to not do the pdflatex
processing
> afterward.
>
> Here are the relevant statements in the BAT script:
>
> echo Sweave("%1",style=F,eps=F) | Rterm --no-save --no-restore
> if not errorlevel == 0 goto end
>
> The problem is that the errorlevel seems to always be 0, even if an error
> occurs. I have a similar shell script for our linux system, and it works
> correctly. Are there no provisions for RTerm to return an exit code in
Windows?
> It would be very useful to me if it would return a nonzero exit code when
there
> is an error.
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
ripley at stats.ox.ac.uk
2006-Oct-14 08:39 UTC
[Rd] No exit codes from RTerm (Windows) (PR#9296)
Rterm (sic) does return an error status. You have not provided a
reproducible example, so here is one (done in tcsh)
% echo 'q()' | rterm --vanilla --slave || echo failed
% echo 'q(status=3)' | rterm --vanilla --slave || echo failed
failed
% echo 'stop("test")' | rterm --vanilla --slave || echo failed
Error: test
Execution halted
failed
Whatever the problem is in your case, it is not what you have erroneously
reported as a bug. (BTW, I knew this worked as the R scripts, including
the build process, make heavy use of it.)
On Fri, 13 Oct 2006, russell-lenth at uiowa.edu wrote:
> Full_Name: Russell V. Lenth
> Version: 2.3.1
Not current: see the FAQ which asks you not to report on obselete versions
of R.
> OS: Windows XP Pro
> Submission from: (NULL) (128.255.132.188)
>
>
> I wrote a simple .BAT file to run the Sweave function on a file (via
RTerm),
> then run pdflatex on the result (after RTerm exits). The issue is that if
an
> error condition occurs in RTerm, it is prudent to not do the pdflatex
processing
> afterward.
>
> Here are the relevant statements in the BAT script:
>
> echo Sweave("%1",style=F,eps=F) | Rterm --no-save --no-restore
> if not errorlevel == 0 goto end
>
> The problem is that the errorlevel seems to always be 0, even if an error
> occurs. I have a similar shell script for our linux system, and it works
> correctly. Are there no provisions for RTerm to return an exit code in
Windows?
> It would be very useful to me if it would return a nonzero exit code when
there
> is an error.
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>
--
Brian D. Ripley, ripley at 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 272866 (PA)
Oxford OX1 3TG, UK Fax: +44 1865 272595
russell-lenth at uiowa.edu
2006-Oct-14 17:56 UTC
[Rd] No exit codes from RTerm (Windows) (PR#9296)
I am so embarrassed. I now see the syntax error in my original batch file; and if I correct it, it works just fine. I don't know why I didn't get a DOS error with it; if I had, it obviously would have saved me from reporting it as an R bug. My apologies for causing trouble -- it definitely is not a bug in R. best, Russ -- Russell V. Lenth, Professor Department of Statistics & Actuarial Science (319)335-0814 FAX (319)335-3017 The University of Iowa russell-lenth at uiowa.edu Iowa City, IA 52242 USA http://www.stat.uiowa.edu/~rlenth/ Prof Brian Ripley wrote:> Rterm (sic) does return an error status. You have not provided a > reproducible example, so here is one (done in tcsh) > > % echo 'q()' | rterm --vanilla --slave || echo failed > % echo 'q(status=3)' | rterm --vanilla --slave || echo failed > failed > % echo 'stop("test")' | rterm --vanilla --slave || echo failed > Error: test > Execution halted > failed > > Whatever the problem is in your case, it is not what you have > erroneously reported as a bug. (BTW, I knew this worked as the R > scripts, including the build process, make heavy use of it.) > > On Fri, 13 Oct 2006, russell-lenth at uiowa.edu wrote: > >> Full_Name: Russell V. Lenth >> Version: 2.3.1 > > > Not current: see the FAQ which asks you not to report on obselete > versions of R. > >> OS: Windows XP Pro >> Submission from: (NULL) (128.255.132.188) >> >> >> I wrote a simple .BAT file to run the Sweave function on a file (via >> RTerm), >> then run pdflatex on the result (after RTerm exits). The issue is >> that if an >> error condition occurs in RTerm, it is prudent to not do the pdflatex >> processing >> afterward. >> >> Here are the relevant statements in the BAT script: >> >> echo Sweave("%1",style=F,eps=F) | Rterm --no-save --no-restore >> if not errorlevel == 0 goto end >> >> The problem is that the errorlevel seems to always be 0, even if an error >> occurs. I have a similar shell script for our linux system, and it works >> correctly. Are there no provisions for RTerm to return an exit code >> in Windows? >> It would be very useful to me if it would return a nonzero exit code >> when there >> is an error. >> >> ______________________________________________ >> R-devel at r-project.org mailing list >> https://stat.ethz.ch/mailman/listinfo/r-devel >> >