similar to: system() and system2() functions

Displaying 20 results from an estimated 1000 matches similar to: "system() and system2() functions"

2019 Dec 15
1
system2 doesn't quote stdin on unix, unlike stdout, stderr & input and on Windows
Hi again! While investigating the bug report [*] I found out that on unix, system2 does not quote its `stdin` argument while preparing the command line to launch. It does shQuote the `stdout` and `stderr` arguments, and also the `f <- tmpfile()` variable (which is used if `input` argument is provided), which seems to set a precedent. On Windows, stdin, stdout, and stderr are handled
2010 Nov 11
1
Problem with system2(), directing STDERR to a file
According to ?system2, I should be able to direct the output of STDERR to a file by giving the filename as a character vector to the "stderr" argument. But here is what happens. Given a ruby script test.rb (with its executable bit set): #!/usr/bin/env ruby STDOUT.puts "stdout" STDERR.puts "stderr" And the following R code: > t <- tempfile() > res <-
2013 Sep 23
1
Capture output of install.packages (pipe system2)
Is there any way to capture output (both stdout and stderr) from install.packages? Solutions like sink and capture.output don't work because the install.packages calls out to system2 which is executed in a separate process: test <- capture.output(install.packages("MASS")) The system2 function does have arguments stdout and stderr but afaik these cannot be controlled via
2019 Mar 19
2
Possibly broken system2 env-option
On Tue, Mar 19, 2019 at 9:59 AM peter dalgaard <pdalgd at gmail.com> wrote: [...] > What you need is something like (NB: single quotes!) > > system2("sh", env = c("VAR='Hello World'"), args = c("-c 'echo $VAR'")) > Hello World Just out of curiosity, do you think it is possible to make this portable, assuming sh is available? On
2019 Mar 18
4
Possibly broken system2 env-option
Hey all, what is wrong with this command: system2("echo", env = c(VAR = "Hello World"), args = c("$VAR")) I am a bit confused, as help("system2") writes about the env option: > character vector of name=value strings to set environment variables. Is this option buggy, or am I using it just wrong? Thanks for your help Henning
2023 Oct 30
1
system()/system2() using short paths of commands on Windows?
Sure. I'm not sure if it's possible to make it easier to reproduce, but for now the example would require installing TinyTeX (via tinytex::install_tinytex(), which can be later uninstalled cleanly via tinytex::uninstall_tinytex() after you finish the investigation). Then run: system2('fmtutil-sys', '--all') # or tinytex:::fmtutil() if fmtutil-sys.exe is not on PATH
2018 Sep 14
2
Bug when calling system/system2 (and request for Bugzilla account)
I hope it's not too specific in my setup... I've tried with system2 added on the first line, so: Example.R: system2('ls', timeout=5) cat('Start non-interruptable functions\n') sample_a <- sample(1:1e7) sample_b <- sample(1:2e7) matching <- match(sample_a, sample_b) cat('Finished\n') Sys.sleep(10) And in terminal/bash: R --vanilla
2023 Nov 16
1
system()/system2() using short paths of commands on Windows?
On 10/31/23 10:05, Duncan Murdoch wrote: > On 31/10/2023 4:32 a.m., Tomas Kalibera wrote: >> >> On 10/30/23 19:07, Yihui Xie wrote: >>> Sure. I'm not sure if it's possible to make it easier to reproduce, >>> but for now the example would require installing TinyTeX (via >>> tinytex::install_tinytex(), which can be later uninstalled cleanly via
2018 Sep 14
3
Bug when calling system/system2 (and request for Bugzilla account)
Hi all, I found some strange behaviour, which I think is a bug. Could someone make an account for me on Bugzilla or pass on my report? The problem: When pressing Ctrl-C when a file is sourced in R, run from Terminal (macOS), sometimes the entire session is ended right away, while I just want to stop the script. This is the case when I press Ctrl-C while some functions are running that don?t
2013 Jul 14
1
Redirect system2 stdout to a file on windows
According to the manual, the `stdout` argument of the `system2` function can redirect output to a file. This seems to work on unix, however I can't get it to work on windows. The toy example below, no `out.txt` or `err.txt` files are created. I tried sending it to an existing file, or expand the full file path, but with no success: setwd(tempdir()) system2("whoami",
2023 Oct 31
1
system()/system2() using short paths of commands on Windows?
On 31/10/2023 4:32 a.m., Tomas Kalibera wrote: > > On 10/30/23 19:07, Yihui Xie wrote: >> Sure. I'm not sure if it's possible to make it easier to reproduce, >> but for now the example would require installing TinyTeX (via >> tinytex::install_tinytex(), which can be later uninstalled cleanly via >> tinytex::uninstall_tinytex() after you finish the
2023 Oct 31
1
system()/system2() using short paths of commands on Windows?
On 10/30/23 19:07, Yihui Xie wrote: > Sure. I'm not sure if it's possible to make it easier to reproduce, > but for now the example would require installing TinyTeX (via > tinytex::install_tinytex(), which can be later uninstalled cleanly via > tinytex::uninstall_tinytex() after you finish the investigation). Then > run: > > ? system2('fmtutil-sys',
2019 Dec 13
1
tempdir() containing spaces breaks installing source packages
Hello everyone! Temp paths are used in system2() calls without shQuote() because they are assumed not to contain spaces. On Windows, GetShortPathName() is used to try to ensure that. Unfortunately, sometimes GetShortPathName() silently fails to return a 8.3 file path and gives a full path instead (8.3 file names might be disabled on newer Windows 10 installations, or there may be another
2019 Feb 28
2
Exit status of Rscript
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.
2015 May 18
4
How best to get around shadowing of executables by system()'s prepending of directories to Windows' PATH?
My question: On Windows, R's system() command prepends several directories to those in the Windows Path variable. >From ?system The search path for 'command' may be system-dependent: it will include the R 'bin' directory, the working directory and the Windows system directories before 'PATH'. This shadows any executables on the Path that share a
2017 Apr 18
2
system/system2 and open file descriptors
It seems that the system() and system2() functions don't close file descriptors between the fork() and exec() (on Unix platforms, of course). This means that the child processes inherit open files and socket connections. Running this (from a terminal) will result in the child process writing to a file that was opened by R: R f <- file('foo.txt', 'w') system('echo
2023 Oct 30
1
system()/system2() using short paths of commands on Windows?
On 10/30/23 17:18, Yihui Xie wrote: > Hi, > > It may have been so for 20+ years but I just discovered today that system() > would always try to use the short path of a command on Windows: > https://github.com/wch/r-source/blob/635a67/src/gnuwin32/run.c#L141 If > that's true, I wonder if it could provide an option to disable this > behavior, because we recently ran into a
2023 Oct 30
2
system()/system2() using short paths of commands on Windows?
I have read about "system() not using a shell on Windows" on the help page many times before but never understood what it means technically. Please forgive my ignorance. I still do not understand it, but thanks a lot for the explanation anyway! I'm just curious if the full path would work in system() today. If it still would not work because today's Windows is still like Windows
2018 Sep 14
0
Bug when calling system/system2 (and request for Bugzilla account)
FWIW I can reproduce on macOS with R 3.5.1. A smaller example: system2("ls", timeout = 5); x <- sample(1:1E8) If I try to interrupt R while that sample call is running, R itself is closed. Best, Kevin On Fri, Sep 14, 2018 at 10:53 AM Emil Bode <emil.bode at dans.knaw.nl> wrote: > > I hope it's not too specific in my setup... > I've tried with system2
2015 Jun 24
0
system2() shortens R.home() to 8.3 form on windows
Hi, So in an interactive R session, R.home() returns the following: > R.home() [1] "D:/biocbld/bbs-3.2-bioc/R" However, if I call it from system2(), I get different results: > system2("R", "-q -e R.home()") > R.home() [1] "D:/biocbld/BBS-3~1.2-B/R" Similarly: > system2("R", "-q -e Sys.getenv('R_HOME')") >