Skip to content

Don't send empty environment vars when not Windows PowerShell dev build #444

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 19, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 17 additions & 4 deletions src/session.ts
Original file line number Diff line number Diff line change
Expand Up @@ -254,12 +254,23 @@ export class SessionManager {
"-Command",
"& '" + startScriptPath + "' " + startArgs);

// Set DEVPATH environment variable if necessary
if (isWindowsDevBuild) {
// The development build looks for this environment variable to
// know where to find its assemblies
process.env.DEVPATH = path.dirname(powerShellExePath);
}
else {
// It's safe to delete this variable even if it doesn't exist
delete process.env.DEVPATH;
}

// Launch PowerShell as child process
this.powerShellProcess =
cp.spawn(
powerShellExePath,
powerShellArgs,
{ env: isWindowsDevBuild ? { "DEVPATH": path.dirname(powerShellExePath) } : {} });
{ env: process.env });

var decoder = new StringDecoder('utf8');
this.powerShellProcess.stdout.on(
Expand Down Expand Up @@ -545,15 +556,17 @@ export class SessionManager {
}

private resolvePowerShellPath(powerShellExePath: string): string {
var resolvedPath = path.resolve(__dirname, powerShellExePath);

// If the path does not exist, show an error
if (!utils.checkIfFileExists(powerShellExePath)) {
if (!utils.checkIfFileExists(resolvedPath)) {
this.setSessionFailure(
"powershell.exe cannot be found or is not accessible at path " + powerShellExePath);
"powershell.exe cannot be found or is not accessible at path " + resolvedPath);

return null;
}

return powerShellExePath;
return resolvedPath;
}

private showSessionMenu() {
Expand Down