From ggrothendieck at gmail.com  Sun Jul 14 22:24:45 2013
From: ggrothendieck at gmail.com (Gabor Grothendieck)
Date: Sun, 14 Jul 2013 16:24:45 -0400
Subject: [Rd] Redirect system2 stdout to a file on windows
In-Reply-To: <CABFfbXt=G7L1=4FFvZS5m=tVmEUg95eOBnJYo7u7GHz2D-keTg@mail.gmail.com>
References: <CABFfbXt=G7L1=4FFvZS5m=tVmEUg95eOBnJYo7u7GHz2D-keTg@mail.gmail.com>
Message-ID: <CAP01uR=5jNc6p_DcC_RGvSk6XunZp=5-GuOrYSa5Viej=z-YUA@mail.gmail.com>

On Sun, Jul 14, 2013 at 1:18 PM, Jeroen Ooms <jeroen.ooms at stat.ucla.edu> wrote:
> 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", stdout="out.txt", stderr="err.txt")
>     file.exists("out.txt")
>
> Am I doing something wrong or is this not supported on windows?
>
> ______________________________________________
> R-devel at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel

Try:

out.txt <- normalizePath("./out.txt", mustWork = FALSE)



--
Statistics & Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com



[Rd] Redirect system2 stdout to a file on windows
Gabor Grothendieck