提交 4cb90f3b 编写于 作者: J Joao Moreno

Merge branch 'krizzdewizz-master'

......@@ -75,6 +75,10 @@ export function terminateProcess(process: ChildProcess, cwd?: string): Terminate
return { success: true };
}
export function getWindowsShell(): string {
return process.env['comspec'] || 'cmd.exe';
}
export abstract class AbstractProcess<TProgressData> {
private cmd: string;
private module: string;
......@@ -233,7 +237,7 @@ export abstract class AbstractProcess<TProgressData> {
} else {
args.push(commandLine.join(' '));
}
childProcess = spawn('cmd.exe', args, options);
childProcess = spawn(getWindowsShell(), args, options);
} else {
if (this.cmd) {
childProcess = spawn(this.cmd, this.args, this.options);
......@@ -321,7 +325,7 @@ export abstract class AbstractProcess<TProgressData> {
if (!this.shell || !Platform.isWindows) {
c(false);
}
let cmdShell = spawn('cmd.exe', ['/s', '/c']);
let cmdShell = spawn(getWindowsShell(), ['/s', '/c']);
cmdShell.on('error', (error:Error) => {
c(true);
});
......
......@@ -15,6 +15,7 @@ import exec = require('vs/workbench/parts/execution/common/execution');
import uri from 'vs/base/common/uri';
import cp = require('child_process');
import processes = require('vs/base/node/processes');
export class AbstractExecutionService implements exec.IExecutionService {
public serviceId = exec.IExecutionService;
......@@ -66,12 +67,14 @@ export class WinExecutionService extends AbstractExecutionService {
return new TPromise<any>((c, e, p) => {
// we use `start` to get another cmd.exe where `& pause` can be handled
const shell = processes.getWindowsShell();
// we use `start` to get another shell where `& pause` can be handled
args = [
'/c',
'start',
'/wait',
'cmd.exe',
shell,
'/c',
strings.format('"{0} {1} & pause"', file, args.join(' '))
];
......@@ -79,7 +82,7 @@ export class WinExecutionService extends AbstractExecutionService {
options = options || <any>{};
(<any>options).windowsVerbatimArguments = true;
childProcess = cp.spawn('cmd.exe', args, options);
childProcess = cp.spawn(shell, args, options);
childProcess.on('exit', c);
childProcess.on('error', e);
......
......@@ -13,6 +13,7 @@ import {IConfigurationService} from 'vs/platform/configuration/common/configurat
import {IMessageService} from 'vs/platform/message/common/message';
import cp = require('child_process');
import processes = require('vs/base/node/processes');
export class WinTerminalService implements ITerminalService {
public serviceId = ITerminalService;
......@@ -24,7 +25,7 @@ export class WinTerminalService implements ITerminalService {
}
public openTerminal(path: string): void {
cp.spawn('cmd.exe', ['/c', 'start', '/wait'], { cwd: path });
cp.spawn(processes.getWindowsShell(), ['/c', 'start', '/wait'], { cwd: path });
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册