[Rd] system(wait = FALSE)

Oliver Soong osoong+r at gmail.com
Thu Feb 24 20:46:34 CET 2011


Sorry, I didn't know about r-windows at r-project.org.  Is that a public
mailing list like r-help?  It's not listed under
http://www.r-project.org/mail.html.

I was able to reproduce the issue under two other 32-bit Windows 7
machines, so it's not specific to the one computer.  It could be
something common to my Windows user account configurations, although
those accounts are not all configured similarly.  The part that's the
strangest to me is that things do work when R is started through the
start menu recent programs and when called from a command shell, but
not through shortcuts or the start menu all programs list.  Sys.getenv
does not indicate any particular difference.  Are there any other
things I might check in R?

The actual command I want to run has quoting concerns (inherent to
Windows and cmd) that force me to use system.  If you don't like cmd
/c dir, this command also serves the purpose and also shows the weird
behavior.  It presumes that Rscript is on the path:
system("Rscript -e \"writeLines(letters,
\\\"C:\\\\\\\\tmp\\\\\\\\tmp.txt\\\")\"", wait = FALSE)

I've been told (and can see) that shell just calls system, and since
the equivalent command in shell shows the same behavior due to this
weirdness I'm finding with system, I decided to focus on what appeared
to be the underlying problem (although perhaps not the actual problem
if it is just something with me).

Oliver


On Wed, Feb 23, 2011 at 11:07 PM, Prof Brian Ripley
<ripley at stats.ox.ac.uk> wrote:
> On Wed, 23 Feb 2011, Oliver Soong wrote:
>
>> I'm having a very odd problem with system(wait = FALSE).  I'm not
>> entirely sure whether it's a bug in R or a problem on our end.  It's
>> related to a post a month or so ago in R-help which got no responses,
>> but I have a little more to add.
>
> Well, the place you are asked to report issues on the Windows port is
> R-windows at r-project.org.   But no one was able to reproduce this, and it
> does sound as if the problem is on your specific machine.  If so, only you
> can debug it and find out if it is really in R.
>
>> This command works as expected (I use c:\tmp since c:\ isn't normally
>> writable under later versions of Windows).
>
> That's a bold claim (and untrue of my Windows 7 systems), but if c:\ is not
> writeable, you cannot create c:\tmp!
>
>>  The file is created at
>> c:\tmp\tmp.txt.
>> system("cmd /c dir > c:\\tmp\\tmp.txt", wait = TRUE)
>> This command does not work as expected.  There is no file created at
>> c:\tmp\tmp.txt.
>> system("cmd /c dir > c:\\tmp\\tmp.txt", wait = FALSE)
>
> Windows' own programs are peculiar things, and often do not obey Windows'
> own rules for everyone else.  So I give little weight to such an example.
>  And in any case, we recommend shell() for such usages.
>
>> The computer is a 64-bit Windows Server 2008R2 machine.  This affects
>> R 2.12.1, both the 32-bit and 64-bit RGui executables but not the
>> RTerm executables.  This does not affect 32-bit Windows XP, 32-bit
>> Windows Server 2003, or 64-bit Windows Server 2008.  This does not
>> affect R 2.12.0, and if I'm reading the svn logs correctly, there were
>> some changes made to the system function from 2.12.0 to 2.12.1.
>> Things seem to work normally when R is started from the start menu
>> recent programs list, but things do not work properly when R is
>> started from a shortcut, from the start menu all programs menu, or
>> through explorer.
>>
>> I'm stumped.  Any ideas I can try?
>>
>> Oliver
>>
>> ______________________________________________
>> 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
>



-- 
Oliver Soong
Donald Bren School of Environmental Science & Management
University of California, Santa Barbara
Santa Barbara, CA 93106-5131
805-893-7044 (office)
610-291-9706 (cell)



More information about the R-devel mailing list