Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(39)

Unified Diff: vpython/run.go

Issue 2867843002: vpython: Forcefully clear PYTHON* environment. (Closed)
Patch Set: Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: vpython/run.go
diff --git a/vpython/run.go b/vpython/run.go
index b817f1cbc46f248df972e4df3d8fa2403cd5c3db..85d42ffe97ba133d67bffe7e00c674d1d84226bf 100644
--- a/vpython/run.go
+++ b/vpython/run.go
@@ -66,6 +66,14 @@ func Run(c context.Context, opts Options) error {
e = environ.System()
}
+ // Remove PYTHONPATH and PYTHONHOME from the environment. This prevents them
+ // from being propagated to delegate processes (e.g., "vpython" script calls
+ // Python script, the "vpython" one uses the Interpreter's IsolatedCommand
+ // to isolate the initial run, but the delegate command blindly uses the
+ // environment that it's provided).
+ e.Remove("PYTHONPATH")
+ e.Remove("PYTHONHOME")
iannucci 2017/05/08 18:59:08 what about site path stuff? or do these cover that
dnj 2017/05/08 19:03:07 Adding PYTHONNOUSERSITE, which prevents this.
+
e.Set("VIRTUAL_ENV", ve.Root) // Set by VirtualEnv script.
if ve.EnvironmentStampPath != "" {
e.Set(EnvironmentStampPathENV, ve.EnvironmentStampPath)
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698