1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
|
From 767399d1d3305cec2aea6b36517e5e74b521e3aa Mon Sep 17 00:00:00 2001
From: Ricardo Wurmus <rekado@elephly.net>
Date: Sun, 20 Dec 2020 14:49:51 +0100
Subject: [PATCH 7/7] detectRLocationsUsingR: Restore R_HOME at the end.
This is not needed when detectRLocationsUsingR is only called by the
server process; for the multi-version feature, however, the rsession
process is calling it, and its R_HOME may not be unset.
---
src/cpp/core/r_util/REnvironmentPosix.cpp | 3 +++
1 file changed, 3 insertions(+)
diff --git a/src/cpp/core/r_util/REnvironmentPosix.cpp b/src/cpp/core/r_util/REnvironmentPosix.cpp
index 07ed73ec05..712e72f19e 100644
--- a/src/cpp/core/r_util/REnvironmentPosix.cpp
+++ b/src/cpp/core/r_util/REnvironmentPosix.cpp
@@ -493,6 +493,7 @@ bool detectRLocationsUsingR(const std::string& rScriptPath,
// (the normal semantics of invoking the R script are that it overwrites
// R_HOME and prints a warning -- this warning is co-mingled with the
// output of R and messes up our parsing)
+ std::string oldRHome = core::system::getenv("R_HOME");
core::system::setenv("R_HOME", "");
// if no R path was specified for a module, the module binary path MUST be specified
@@ -602,6 +603,8 @@ bool detectRLocationsUsingR(const std::string& rScriptPath,
return false;
}
+ // restore R_HOME
+ core::system::setenv("R_HOME", oldRHome);
return true;
}
#endif
--
2.54.0
|