提交 a6c845ba 编写于 作者: D Daniel Imms

Force upper case drive names in external terminal

This change needs to be made at this layer since a change to URI.fsPath
(the root cause) is too risky as lower case drives are relied upon.

Part of #9448
上级 3dcc5677
......@@ -2,6 +2,7 @@
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
'use strict';
import cp = require('child_process');
......@@ -71,6 +72,11 @@ export class WinTerminalService implements ITerminalService {
// contains spaces
let cmdArgs = ['/c', 'start', '/wait', '""', exec];
// Make the drive letter uppercase on Windows (see #9448)
if (path && path[1] === ':') {
path = path[0].toUpperCase() + path.substr(1);
}
return new TPromise<void>((c, e) => {
let env = path ? { cwd: path } : void 0;
let child = spawner.spawn(command, cmdArgs, env);
......
......@@ -79,6 +79,30 @@ suite('Execution - TerminalService', () => {
);
});
test("WinTerminalService - uses default terminal when configuration.terminal.external.windowsExec is undefined", done => {
let testShell = 'cmd';
let testCwd = 'c:/foo';
let mockSpawner = {
spawn: (command, args, opts) => {
// assert
equal(opts.cwd, 'C:/foo', 'cwd should be uppercase regardless of the case that\'s passed in');
done();
return {
on: (evt) => evt
}
}
};
let testService = new WinTerminalService(mockConfig);
(<any>testService).spawnTerminal(
mockSpawner,
mockConfig,
testShell,
testCwd,
mockOnExit,
mockOnError
);
});
test("MacTerminalService - uses terminal from configuration", done => {
let testCwd = 'path/to/workspace';
let mockSpawner = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册