Notebooks: Ensure Python Environment Variables are Removed Before First Python Command (#13097)

* Add CodeQL Analysis workflow (#10195)

* Add CodeQL Analysis workflow

* Fix path

* Ensure we delete python env vars correctly

* Move delete to top of method

Co-authored-by: Justin Hutchings <jhutchings1@users.noreply.github.com>
This commit is contained in:
Chris LaFreniere
2020-10-30 11:06:46 -07:00
committed by GitHub
parent 82d5fe3821
commit dfb40e0159

View File

@@ -288,6 +288,11 @@ export class JupyterServerInstallation implements IJupyterServerInstallation {
}
public async configurePackagePaths(): Promise<void> {
// Delete existing Python variables in ADS to prevent conflict with other installs
delete process.env['PYTHONPATH'];
delete process.env['PYTHONSTARTUP'];
delete process.env['PYTHONHOME'];
//Python source path up to bundle version
let pythonSourcePath = this._usingExistingPython
? this._pythonInstallationPath
@@ -329,11 +334,6 @@ export class JupyterServerInstallation implements IJupyterServerInstallation {
}
}
// Delete existing Python variables in ADS to prevent conflict with other installs
delete process.env['PYTHONPATH'];
delete process.env['PYTHONSTARTUP'];
delete process.env['PYTHONHOME'];
// Store the executable options to run child processes with env var without interfering parent env var.
let env = Object.assign({}, process.env);
delete env['Path']; // Delete extra 'Path' variable for Windows, just in case.