Displaying 20 results from an estimated 9000 matches similar to: "Possibly broken system2 env-option"
2019 Mar 19
0
Possibly broken system2 env-option
You are using it wrong. It wants strings of the form "name=value", not a character vector with names as labels. So this is closer to the mark:
> system2("echo", env = c("VAR='Hello World'"), args = c("$VAR"))
>
However, as you see it doesn't work as intended. The problem is that the $-substitution refers to the environment of the shell
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 19
0
Possibly broken system2 env-option
On Windows, ?env? is only supported for commands such as ?R? and
?make? which accept environment variables on their command line.
So I suppose that would be tricky.
The basic issue is that on Unix-alikes, system2 constructs a command like
FOO=bar cmd args
and passes that to sh via system(). On windoes, system() does not call sh, so system2() does (effectively)
cmd FOO=bar args
and
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 <-
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
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
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
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",
2010 Nov 02
1
system() and system2() functions
Hello,
I help to maintain a moderate library of R code. In this code we have a number
of calls to the system function along the lines of:
exe_output = system("./executable.exe",intern=T)
We tend to prefer system() over shell() because, provided the executable has
been compiled and the working directory set, the command works under both linux
and windows.
We've never had 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
2010 Oct 02
1
cleanup_pkg() in tools:::.build_packages() is broken
Hi,
The cleanup_pkg() function defined the big tools:::.build_packages()
function in tools/R/build.R is currently broken. When Makefiles are
used cleanup_pkg() doesn't clean anything because of the way system2()
is called.
For example, the call to Ssystem() on line 304 (Ssystem is a silent
version of system2) is basically trying to do this:
>
2018 Jan 26
2
utils::install.packages with quiet=TRUE fails for source packages on Windows
Hi,
Installing a source package on Windows using utils::install.packages()
with quiet=TRUE fails, while it works with the default quiet = FALSE.
The problem seems to be caused by the fact that when quiet = TRUE,
stdout and stderr are set to FALSE when calling "R CMD INSTALL" with
base::system2() here:
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 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 Jan 26
1
utils::install.packages with quiet=TRUE fails for source packages on Windows
The obvious guess would be that Rstudio is attempting something like redirecting output and getting itself confused. However, it is pretty clearly Their Problem, no? Rstudio has their own support infrastructure.
-pd
> On 26 Jan 2018, at 09:17 , Andreas Kersting <r-devel at akersting.de> wrote:
>
> Just noticed that this problem only occurs from within RStudio (v1.1.414). Any
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',
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
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
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')")
>