From erich.neuwirth@univie.ac.at  Fri Feb  9 14:38:17 2001
From: erich.neuwirth@univie.ac.at (Erich Neuwirth)
Date: Fri, 09 Feb 2001 15:38:17 +0100
Subject: [Rd] system command
References: <Pine.GSO.4.31.0102091415080.18117-100000@toucan.stats>
Message-ID: <3A8400D9.F1AB4A14@univie.ac.at>

you are right,
i was using stdin in places where i meant stdout.
stupido.
logically, just do a global replace stdin->stdout in my last message.

currently i am trying to convince the maintainer of csound to add a
command line switch
which switches of stderr output completely.

and i understand theat the unix version and the windows version are
different.
but it still makes sense that they behave as similar as possible
whenever possible.

the whole thing is caused by the fact that the current version of csound
writes to stderr in any case.

and system on unix puts the stderr output in the r console window
in any case. that is what surprises me.
alternatively, system could ignore stderr,
or have an option for ingoring stderr.



Prof Brian Ripley wrote:
> 
> On Fri, 9 Feb 2001, Erich Neuwirth wrote:
> 
> > i am using
> > system
> > to call the external program csound.
> > csound does some output to stdout and some to stderr
> > system handles this differently on the different platforms.
> >
> > on unix (i have solaris, but as far as i know it is the same on linux)
> > system("csound",intern=TRUE) redirects stdin into an R object,
> > by still outputs stdout to the R window.
> 
> I *think* you mean redirect stdout, and sends stderr to the terminal
> running R.
> 
> > system("csound",intern=FALSE) (equivalent to system("csound"))
> > stdout and stderr go into the R window
> >
> > Rterm
> > on win95
> > system("csound",intern=TRUE) redirects stdin and stderr into an R object
> 
> Redirects stdout and stderr to the terminal running R?
> 
> > system("csound",intern=FALSE) (equivalent to system("csound"))
> > outputs everything
> >
> > Rterm
> > on win2k
> > system("csound",intern=TRUE) redirects stdin and stderr into an R object
> > system("csound",intern=FALSE) (equivalent to system("csound"))
> > outputs everything
> > EXCEPT
> > once
> > system("csound",intern=TRUE) has been done
> > and later one tries
> > system("csound",intern=FALSE)
> > stderr is lost completely.
> > going back to
> > system("csound",intern=TRUE)
> > redirects stderr again into the R object,
> > but stderr does not go to the screen any more
> > after intern=TRUE has been used once.
> >
> >
> > so we seem to have to problems:
> > 1) different behavior of system on unix and win32k
> 
> They are documented to be different!  Whether stdout and stderr are
> different is OS-specific.  In particular, Windows consoles have no concept
> of stdout.
> 
> > 2) problems with system and redirection on win32k.
> 
> A bug, almost certainly in Windows 2000 since this works as documented
> under NT.   Guido?
> 
> But, the essence is that you cannot reasonably expect to use stderr from
> a program run by a system() commands, and that applies to, say, Perl
> as much as to R.
> 
> --
> Brian D. Ripley,                  ripley@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 272860 (secr)
> Oxford OX1 3TG, UK                Fax:  +44 1865 272595

--
Erich Neuwirth, Computer Supported Didactics Working Group
Visit our SunSITE at http://sunsite.univie.ac.at
Phone: +43-1-4277-38624 Fax: +43-1-4277-9386
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] system command
Erich Neuwirth