@@ -254,12 +254,23 @@ export class SessionManager {
254254 "-Command" ,
255255 "& '" + startScriptPath + "' " + startArgs ) ;
256256
257+ // Set DEVPATH environment variable if necessary
258+ if ( isWindowsDevBuild ) {
259+ // The development build looks for this environment variable to
260+ // know where to find its assemblies
261+ process . env . DEVPATH = path . dirname ( powerShellExePath ) ;
262+ }
263+ else {
264+ // It's safe to delete this variable even if it doesn't exist
265+ delete process . env . DEVPATH ;
266+ }
267+
257268 // Launch PowerShell as child process
258269 this . powerShellProcess =
259270 cp . spawn (
260271 powerShellExePath ,
261272 powerShellArgs ,
262- { env : isWindowsDevBuild ? { "DEVPATH" : path . dirname ( powerShellExePath ) } : { } } ) ;
273+ { env : process . env } ) ;
263274
264275 var decoder = new StringDecoder ( 'utf8' ) ;
265276 this . powerShellProcess . stdout . on (
@@ -545,15 +556,17 @@ export class SessionManager {
545556 }
546557
547558 private resolvePowerShellPath ( powerShellExePath : string ) : string {
559+ var resolvedPath = path . resolve ( __dirname , powerShellExePath ) ;
560+
548561 // If the path does not exist, show an error
549- if ( ! utils . checkIfFileExists ( powerShellExePath ) ) {
562+ if ( ! utils . checkIfFileExists ( resolvedPath ) ) {
550563 this . setSessionFailure (
551- "powershell.exe cannot be found or is not accessible at path " + powerShellExePath ) ;
564+ "powershell.exe cannot be found or is not accessible at path " + resolvedPath ) ;
552565
553566 return null ;
554567 }
555568
556- return powerShellExePath ;
569+ return resolvedPath ;
557570 }
558571
559572 private showSessionMenu ( ) {
0 commit comments