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

Merge branch 'krizzdewizz-master'

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