Skip to content

Commit 24c48b7

Browse files
authored
Merge pull request #570 from daviwil/fix-532
Fix #532: DEVPATH env variable not being set for integrated console
2 parents 899377a + cdb3426 commit 24c48b7

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

src/session.ts

+12-8
Original file line numberDiff line numberDiff line change
@@ -284,15 +284,19 @@ export class SessionManager {
284284
"-Command",
285285
"& '" + startScriptPath + "' " + startArgs);
286286

287-
// Set DEVPATH environment variable if necessary
288287
if (isWindowsDevBuild) {
289-
// The development build looks for this environment variable to
290-
// know where to find its assemblies
291-
process.env.DEVPATH = path.dirname(powerShellExePath);
292-
}
293-
else {
294-
// It's safe to delete this variable even if it doesn't exist
295-
delete process.env.DEVPATH;
288+
// Windows PowerShell development builds need the DEVPATH environment
289+
// variable set to the folder where development binaries are held
290+
291+
// NOTE: This batch file approach is needed temporarily until VS Code's
292+
// createTerminal API gets an argument for setting environment variables
293+
// on the launched process.
294+
var batScriptPath = path.resolve(__dirname, '../sessions/powershell.bat');
295+
fs.writeFileSync(
296+
batScriptPath,
297+
`@set DEVPATH=${path.dirname(powerShellExePath)}\r\n@${powerShellExePath} %*`);
298+
299+
powerShellExePath = batScriptPath;
296300
}
297301

298302
// Make sure no old session file exists

0 commit comments

Comments
 (0)