[rkward-cvs] SF.net SVN: rkward:[3411] trunk/rkward/rkward/rbackend/rpackages/rkward/R/ internal.R

tfry at users.sourceforge.net tfry at users.sourceforge.net
Wed Feb 2 09:05:57 UTC 2011


Revision: 3411
          http://rkward.svn.sourceforge.net/rkward/?rev=3411&view=rev
Author:   tfry
Date:     2011-02-02 09:05:56 +0000 (Wed, 02 Feb 2011)

Log Message:
-----------
Make system() overload work with R < 2.12. Also rewrite code a bit.

Modified Paths:
--------------
    trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R

Modified: trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R
===================================================================
--- trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R	2011-02-01 16:19:11 UTC (rev 3410)
+++ trunk/rkward/rkward/rbackend/rpackages/rkward/R/internal.R	2011-02-02 09:05:56 UTC (rev 3411)
@@ -472,12 +472,14 @@
 
 # Add output synchronisation across system(), and system2() calls.
 "system" <- function () {
-	if (intern || ignore.stdout || ignore.stderr) eval (body (.rk.system.default))
-	else {
+	if (!exists ("ignore.stdout", inherits=FALSE)) ignore.stdout <- FALSE	# ignore.stdout was introduced in R 2.12.0
+
+	if (!(intern || (ignore.stdout && ignore.stderr))) {
 		.Call ("rk.sync.output", 0)
 		on.exit (.Call ("rk.sync.output", 1), TRUE)
-		eval (body (.rk.system.default))
 	}
+
+	eval (body (.rk.system.default))
 }
 formals (system) <- formals (base::system)
 .rk.system.default <- base::system
@@ -485,12 +487,11 @@
 # NOTE: system2 was not introduced before R 2.12.0 (or was it 2.11.0?)
 if (exists ("system2", base::.BaseNamespaceEnv)) {
 	"system2" <- function () {
-		if (stdout == "" && stderr == "") eval (body (.rk.system2.default))
-		else {
+		if (stdout != "" || stderr != "") {
 			.Call ("rk.sync.output", 0)
 			on.exit (.Call ("rk.sync.output", 1), TRUE)
-			eval (body (.rk.system2.default))
 		}
+		eval (body (.rk.system2.default))
 	}
 	formals (system2) <- formals (base::system2)
 	.rk.system2.default <- base::system2


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the rkward-tracker mailing list