integrated debug terminal: support env vars for PowerShell; fixes Microsoft/vscode#11785

This commit is contained in:
Andre Weinand 2016-09-14 23:16:20 +02:00
parent acc4e94ee6
commit ef69b2cc39

View file

@ -51,18 +51,18 @@ export class TerminalSupport {
return (s.indexOf(' ') >= 0 || s.indexOf('"') >= 0) ? `"${s}"` : s;
};
const conf = configurationService.getConfiguration<IIntegratedTerminalConfiguration>();
let isPowerShell = false;
if (conf.terminal && conf.terminal.integrated && conf.terminal.integrated.shell && conf.terminal.integrated.shell.windows) {
isPowerShell = conf.terminal.integrated.shell.windows.indexOf('PowerShell') >= 0;
}
const windows_shell = configurationService.getConfiguration<IIntegratedTerminalConfiguration>().terminal.integrated.shell.windows;
const isPowerShell = windows_shell ? windows_shell.toLowerCase().indexOf('powershell') >= 0 : false;
if (isPowerShell) {
if (args.cwd) {
command += `cd ${quote(args.cwd)}; `;
}
if (args.env) {
for (let key in args.env) {
command += `$env:${key}='${args.env[key]}'; `;
}
}
for (let a of args.args) {
command += `${quote(a)} `;
}