Exit status of Rscript

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Exit status of Rscript

michellang
Current R release (3.5.2) and devel return a 0 exit status on error,
while prior versions returned a non-zero exit status. On Linux and
MacOs, the following line returns TRUE for R-3.5.2 and R-devel, and
FALSE for R-3.5.1 and R-3.5.0:

system2("Rscript", c("-e", shQuote("stop('foo')"))) == 0

I didn't find this in the NEWS, so I believe this is a bug.

Best,
Michel

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Exit status of Rscript

Rui Barradas
Hello,

I cannot reproduce this, R 3.5.2 on Ubuntu 18.04 LTS. sessionInfo() below.

system2("Rscript", c("-e", shQuote("stop('foo')"))) == 0
#Erro: foo
#Execução interrompida
#[1] FALSE

r <- system2("Rscript", c("-e", shQuote("stop('foo')")))
#Erro: foo
#Execução interrompida

print(r)
#[1] 1


sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Ubuntu 18.04.1 LTS

Matrix products: default
BLAS: /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.7.1
LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.7.1

locale:
  [1] LC_CTYPE=pt_PT.UTF-8       LC_NUMERIC=C
  [3] LC_TIME=pt_PT.UTF-8        LC_COLLATE=pt_PT.UTF-8
  [5] LC_MONETARY=pt_PT.UTF-8    LC_MESSAGES=pt_PT.UTF-8
  [7] LC_PAPER=pt_PT.UTF-8       LC_NAME=C
  [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=pt_PT.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods
[7] base

loaded via a namespace (and not attached):
[1] compiler_3.5.2 tools_3.5.2    yaml_2.2.0


Hope this helps,

Rui Barradas

Às 12:23 de 28/02/2019, Michel Lang escreveu:

> Current R release (3.5.2) and devel return a 0 exit status on error,
> while prior versions returned a non-zero exit status. On Linux and
> MacOs, the following line returns TRUE for R-3.5.2 and R-devel, and
> FALSE for R-3.5.1 and R-3.5.0:
>
> system2("Rscript", c("-e", shQuote("stop('foo')"))) == 0
>
> I didn't find this in the NEWS, so I believe this is a bug.
>
> Best,
> Michel
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel
Reply | Threaded
Open this post in threaded view
|

Re: Exit status of Rscript

Simon Urbanek
In reply to this post by michellang
> system2("Rscript", c("-e", shQuote("stop('foo')"))) == 0
Error: foo
Execution halted
[1] FALSE
> sessionInfo()
R version 3.5.2 (2018-12-20)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: OS X El Capitan 10.11.6

> system2("Rscript", c("-e", shQuote("stop('foo')"))) == 0
Error: foo
Execution halted
[1] FALSE
> sessionInfo()
R Under development (unstable) (2019-02-27 r76167)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: OS X El Capitan 10.11.6

You may also want to check that you run what you think you do in the shell:

$ Rscript -e 'print(R.version.string); stop("foo")'; echo $?
[1] "R Under development (unstable) (2019-02-27 r76167)"
Error: foo
Execution halted
1

$ Rscript -e 'print(R.version.string); stop("foo")'; echo $?
[1] "R version 3.5.2 (2018-12-20)"
Error: foo
Execution halted
1

$ Rscript -e 'print(R.version.string); stop("foo")'; echo $?
[1] "R version 3.4.4 Patched (2018-03-19 r75535)"
Error: foo
Execution halted
1


> On Feb 28, 2019, at 7:23 AM, Michel Lang <[hidden email]> wrote:
>
> Current R release (3.5.2) and devel return a 0 exit status on error,
> while prior versions returned a non-zero exit status. On Linux and
> MacOs, the following line returns TRUE for R-3.5.2 and R-devel, and
> FALSE for R-3.5.1 and R-3.5.0:
>
> system2("Rscript", c("-e", shQuote("stop('foo')"))) == 0
>
> I didn't find this in the NEWS, so I believe this is a bug.
>
> Best,
> Michel
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel