@@ -254,12 +254,23 @@ export class SessionManager {
254
254
"-Command" ,
255
255
"& '" + startScriptPath + "' " + startArgs ) ;
256
256
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
+
257
268
// Launch PowerShell as child process
258
269
this . powerShellProcess =
259
270
cp . spawn (
260
271
powerShellExePath ,
261
272
powerShellArgs ,
262
- { env : isWindowsDevBuild ? { "DEVPATH" : path . dirname ( powerShellExePath ) } : { } } ) ;
273
+ { env : process . env } ) ;
263
274
264
275
var decoder = new StringDecoder ( 'utf8' ) ;
265
276
this . powerShellProcess . stdout . on (
@@ -545,15 +556,17 @@ export class SessionManager {
545
556
}
546
557
547
558
private resolvePowerShellPath ( powerShellExePath : string ) : string {
559
+ var resolvedPath = path . resolve ( __dirname , powerShellExePath ) ;
560
+
548
561
// If the path does not exist, show an error
549
- if ( ! utils . checkIfFileExists ( powerShellExePath ) ) {
562
+ if ( ! utils . checkIfFileExists ( resolvedPath ) ) {
550
563
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 ) ;
552
565
553
566
return null ;
554
567
}
555
568
556
- return powerShellExePath ;
569
+ return resolvedPath ;
557
570
}
558
571
559
572
private showSessionMenu ( ) {
0 commit comments