Full_Name: Gabor Grothendieck
Version: 1.8.0
OS: Windows 2000 Pro
Submission from: (NULL) (67.68.47.99)
In R 1.8.0 on Windows 2000 suppose that \a.bat contains the following two
lines:
net /?
dir \winnt
which constitutes a simple batch file which
1. writes a help message about the built in Windows net command to stderr and
2. does a dir on the built in Windows directory WINNT writing result to stdout
You can replace #1 with any other command which outputs to stderr and #2 with
any other command that outputs to stdout. I just chose those commands since
they come with Windows.
If you start up R and run a pipe which executes \a.bat one gets
the following werid behavior on Windows 2000:
> readLines(pipe("\\a.bat"))
[1] ""
[2] "C:\\Program Files\\R\\rw1080>net /? "
[3] "The syntax of this command is:"
[4] ""
[5] ""
[6] ""
[7] ""
[8] "NET [ ACCOUNTS | COMPUTER | CONFIG | CONTINUE | FILE | GROUP | HELP
|"
[9] " HELPMSG | LOCALGROUP | NAME | PAUSE | PRINT | SEND | SESSION
|"
[10] " SHARE | START | STATISTICS | STOP | TIME | USE | USER | VIEW
]"
[11] ""
[12] ""
[13] "C:\\Program Files\\R\\rw1080>dir \\a.bat "
[14] " Volume in drive C has no label."
[15] " Volume Serial Number is 07D1-011A"
[16] ""
[17] " Directory of C:\\"
[18] ""
[19] "11/12/2003 05:07p 20 a.bat"
[20] " 1 File(s) 20 bytes"
[21] " 0 Dir(s) 484,712,448 bytes free"
There are several problems:
1. I am getting both the stderr (the output from net /?) and the stdout
(the output from dir).
2. The first line contains a weird character. This character changes if
I perform the R command multiple times.
3. Usually I get the above but sometimes I get no output from readLines at
all.
I found this when I was trying to pipe output from a command (not the above
batch file which is just an simpler example) to R and finally traced it the
above.
The above is sufficiently serious that I can't use pipes in R currently
on Windows 2000.
I am using R 1.8.0 but R 1.7.1 gives the same.
I had previously posted a version of this to r-help just to verify whether it
was a bug or not but no one answered so I guess it is. My r-help message
used gawk instead of a batch file to illustrate this behavior. See:
https://www.stat.math.ethz.ch/pipermail/r-help/2003-November/040426.html