[rkward] rkward/rbackend: Fix version detection bug that affected object name printing
Thomas Friedrichsmeier
null at kde.org
Sat Jan 12 09:31:36 GMT 2019
Git commit 8928395eea6768ff4566854938a9053b7cbf6ca6 by Thomas Friedrichsmeier.
Committed on 12/01/2019 at 09:30.
Pushed by tfry into branch 'master'.
Fix version detection bug that affected object name printing
M +6 -1 rkward/rbackend/rkrbackend.cpp
https://commits.kde.org/rkward/8928395eea6768ff4566854938a9053b7cbf6ca6
diff --git a/rkward/rbackend/rkrbackend.cpp b/rkward/rbackend/rkrbackend.cpp
index b5b33416..791335a3 100644
--- a/rkward/rbackend/rkrbackend.cpp
+++ b/rkward/rbackend/rkrbackend.cpp
@@ -1145,14 +1145,19 @@ bool RKRBackend::startR () {
win_do_detect_winutf8markers = false;
#endif
+ // What the??? Somehow the first command we run *will* appear to throw a syntax error. Some init step seems to be missing, but where?
+ // Anyway, we just run a dummy to "clear" that trap.
+ runDirectCommand ("\n");
+
// get info on R runtime version
- RCommandProxy *dummy = runDirectCommand ("as.numeric (R.version$major) * 1000 + as.numeric (R.version$minor) * 10", RCommand::GetIntVector);
+ RCommandProxy *dummy = runDirectCommand ("(as.numeric(R.version$major)*1000+as.numeric(R.version$minor)*10)\n", RCommand::GetIntVector);
if ((dummy->getDataType () == RData::IntVector) && (dummy->getDataLength () == 1)) {
r_version = dummy->intVector ().at (0);
} else {
RK_ASSERT (false);
r_version = 0;
}
+ delete dummy;
return true;
}
More information about the rkward-tracker
mailing list