@theia/external-terminal 1.34.1 → 1.34.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +641 -641
- package/README.md +46 -46
- package/lib/common/external-terminal.d.ts +34 -34
- package/lib/common/external-terminal.js +20 -20
- package/lib/electron-browser/external-terminal-contribution.d.ts +35 -35
- package/lib/electron-browser/external-terminal-contribution.js +128 -128
- package/lib/electron-browser/external-terminal-frontend-module.d.ts +3 -3
- package/lib/electron-browser/external-terminal-frontend-module.js +29 -29
- package/lib/electron-browser/external-terminal-preference.d.ts +26 -26
- package/lib/electron-browser/external-terminal-preference.js +109 -109
- package/lib/electron-node/external-terminal-backend-module.d.ts +4 -4
- package/lib/electron-node/external-terminal-backend-module.js +35 -35
- package/lib/electron-node/linux-external-terminal-service.d.ts +20 -20
- package/lib/electron-node/linux-external-terminal-service.js +102 -102
- package/lib/electron-node/mac-external-terminal-service.d.ts +18 -18
- package/lib/electron-node/mac-external-terminal-service.js +74 -74
- package/lib/electron-node/windows-external-terminal-service.d.ts +25 -25
- package/lib/electron-node/windows-external-terminal-service.js +107 -107
- package/lib/package.spec.js +25 -25
- package/package.json +6 -6
- package/src/common/external-terminal.ts +55 -55
- package/src/electron-browser/external-terminal-contribution.ts +116 -116
- package/src/electron-browser/external-terminal-frontend-module.ts +33 -33
- package/src/electron-browser/external-terminal-preference.ts +106 -106
- package/src/electron-node/external-terminal-backend-module.ts +40 -40
- package/src/electron-node/linux-external-terminal-service.ts +95 -95
- package/src/electron-node/mac-external-terminal-service.ts +70 -70
- package/src/electron-node/windows-external-terminal-service.ts +110 -110
- package/src/package.spec.ts +29 -29
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { ExternalTerminalService, ExternalTerminalConfiguration } from '../common/external-terminal';
|
|
2
|
-
export declare class MacExternalTerminalService implements ExternalTerminalService {
|
|
3
|
-
protected osxOpener: string;
|
|
4
|
-
protected defaultTerminalApp: string;
|
|
5
|
-
openTerminal(configuration: ExternalTerminalConfiguration, cwd: string): Promise<void>;
|
|
6
|
-
getDefaultExec(): Promise<string>;
|
|
7
|
-
/**
|
|
8
|
-
* Spawn the external terminal for the given options.
|
|
9
|
-
* - The method spawns the terminal application based on the preferences, else uses the default value.
|
|
10
|
-
* @param configuration the preference configuration.
|
|
11
|
-
* @param cwd the optional current working directory to spawn from.
|
|
12
|
-
*/
|
|
13
|
-
protected spawnTerminal(configuration: ExternalTerminalConfiguration, cwd?: string): Promise<void>;
|
|
14
|
-
/**
|
|
15
|
-
* Get the default terminal app on OSX.
|
|
16
|
-
*/
|
|
17
|
-
protected getDefaultTerminalOSX(): string;
|
|
18
|
-
}
|
|
1
|
+
import { ExternalTerminalService, ExternalTerminalConfiguration } from '../common/external-terminal';
|
|
2
|
+
export declare class MacExternalTerminalService implements ExternalTerminalService {
|
|
3
|
+
protected osxOpener: string;
|
|
4
|
+
protected defaultTerminalApp: string;
|
|
5
|
+
openTerminal(configuration: ExternalTerminalConfiguration, cwd: string): Promise<void>;
|
|
6
|
+
getDefaultExec(): Promise<string>;
|
|
7
|
+
/**
|
|
8
|
+
* Spawn the external terminal for the given options.
|
|
9
|
+
* - The method spawns the terminal application based on the preferences, else uses the default value.
|
|
10
|
+
* @param configuration the preference configuration.
|
|
11
|
+
* @param cwd the optional current working directory to spawn from.
|
|
12
|
+
*/
|
|
13
|
+
protected spawnTerminal(configuration: ExternalTerminalConfiguration, cwd?: string): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Get the default terminal app on OSX.
|
|
16
|
+
*/
|
|
17
|
+
protected getDefaultTerminalOSX(): string;
|
|
18
|
+
}
|
|
19
19
|
//# sourceMappingURL=mac-external-terminal-service.d.ts.map
|
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2021 Ericsson and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
-
};
|
|
23
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.MacExternalTerminalService = void 0;
|
|
25
|
-
const cp = require("child_process");
|
|
26
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
27
|
-
const file_uri_1 = require("@theia/core/lib/node/file-uri");
|
|
28
|
-
/*---------------------------------------------------------------------------------------------
|
|
29
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
30
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
31
|
-
*--------------------------------------------------------------------------------------------*/
|
|
32
|
-
// some code copied and modified from https://github.com/microsoft/vscode/blob/1.52.1/src/vs/workbench/contrib/externalTerminal/node/externalTerminalService.ts
|
|
33
|
-
let MacExternalTerminalService = class MacExternalTerminalService {
|
|
34
|
-
constructor() {
|
|
35
|
-
this.osxOpener = '/usr/bin/open';
|
|
36
|
-
this.defaultTerminalApp = 'Terminal.app';
|
|
37
|
-
}
|
|
38
|
-
async openTerminal(configuration, cwd) {
|
|
39
|
-
await this.spawnTerminal(configuration, file_uri_1.FileUri.fsPath(cwd));
|
|
40
|
-
}
|
|
41
|
-
async getDefaultExec() {
|
|
42
|
-
return this.getDefaultTerminalOSX();
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Spawn the external terminal for the given options.
|
|
46
|
-
* - The method spawns the terminal application based on the preferences, else uses the default value.
|
|
47
|
-
* @param configuration the preference configuration.
|
|
48
|
-
* @param cwd the optional current working directory to spawn from.
|
|
49
|
-
*/
|
|
50
|
-
async spawnTerminal(configuration, cwd) {
|
|
51
|
-
// Use the executable value from the preferences if available, else fallback to the default.
|
|
52
|
-
const terminalConfig = configuration['terminal.external.osxExec'];
|
|
53
|
-
const terminalApp = terminalConfig || this.getDefaultTerminalOSX();
|
|
54
|
-
return new Promise((resolve, reject) => {
|
|
55
|
-
const args = ['-a', terminalApp];
|
|
56
|
-
if (cwd) {
|
|
57
|
-
args.push(cwd);
|
|
58
|
-
}
|
|
59
|
-
const child = cp.spawn(this.osxOpener, args);
|
|
60
|
-
child.on('error', reject);
|
|
61
|
-
child.on('exit', () => resolve());
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Get the default terminal app on OSX.
|
|
66
|
-
*/
|
|
67
|
-
getDefaultTerminalOSX() {
|
|
68
|
-
return this.defaultTerminalApp;
|
|
69
|
-
}
|
|
70
|
-
};
|
|
71
|
-
MacExternalTerminalService = __decorate([
|
|
72
|
-
(0, inversify_1.injectable)()
|
|
73
|
-
], MacExternalTerminalService);
|
|
74
|
-
exports.MacExternalTerminalService = MacExternalTerminalService;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2021 Ericsson and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.MacExternalTerminalService = void 0;
|
|
25
|
+
const cp = require("child_process");
|
|
26
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
27
|
+
const file_uri_1 = require("@theia/core/lib/node/file-uri");
|
|
28
|
+
/*---------------------------------------------------------------------------------------------
|
|
29
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
30
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
31
|
+
*--------------------------------------------------------------------------------------------*/
|
|
32
|
+
// some code copied and modified from https://github.com/microsoft/vscode/blob/1.52.1/src/vs/workbench/contrib/externalTerminal/node/externalTerminalService.ts
|
|
33
|
+
let MacExternalTerminalService = class MacExternalTerminalService {
|
|
34
|
+
constructor() {
|
|
35
|
+
this.osxOpener = '/usr/bin/open';
|
|
36
|
+
this.defaultTerminalApp = 'Terminal.app';
|
|
37
|
+
}
|
|
38
|
+
async openTerminal(configuration, cwd) {
|
|
39
|
+
await this.spawnTerminal(configuration, file_uri_1.FileUri.fsPath(cwd));
|
|
40
|
+
}
|
|
41
|
+
async getDefaultExec() {
|
|
42
|
+
return this.getDefaultTerminalOSX();
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Spawn the external terminal for the given options.
|
|
46
|
+
* - The method spawns the terminal application based on the preferences, else uses the default value.
|
|
47
|
+
* @param configuration the preference configuration.
|
|
48
|
+
* @param cwd the optional current working directory to spawn from.
|
|
49
|
+
*/
|
|
50
|
+
async spawnTerminal(configuration, cwd) {
|
|
51
|
+
// Use the executable value from the preferences if available, else fallback to the default.
|
|
52
|
+
const terminalConfig = configuration['terminal.external.osxExec'];
|
|
53
|
+
const terminalApp = terminalConfig || this.getDefaultTerminalOSX();
|
|
54
|
+
return new Promise((resolve, reject) => {
|
|
55
|
+
const args = ['-a', terminalApp];
|
|
56
|
+
if (cwd) {
|
|
57
|
+
args.push(cwd);
|
|
58
|
+
}
|
|
59
|
+
const child = cp.spawn(this.osxOpener, args);
|
|
60
|
+
child.on('error', reject);
|
|
61
|
+
child.on('exit', () => resolve());
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Get the default terminal app on OSX.
|
|
66
|
+
*/
|
|
67
|
+
getDefaultTerminalOSX() {
|
|
68
|
+
return this.defaultTerminalApp;
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
MacExternalTerminalService = __decorate([
|
|
72
|
+
(0, inversify_1.injectable)()
|
|
73
|
+
], MacExternalTerminalService);
|
|
74
|
+
exports.MacExternalTerminalService = MacExternalTerminalService;
|
|
75
75
|
//# sourceMappingURL=mac-external-terminal-service.js.map
|
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
import { ExternalTerminalService, ExternalTerminalConfiguration } from '../common/external-terminal';
|
|
2
|
-
export declare class WindowsExternalTerminalService implements ExternalTerminalService {
|
|
3
|
-
protected readonly CMD = "cmd.exe";
|
|
4
|
-
protected DEFAULT_TERMINAL_WINDOWS: string;
|
|
5
|
-
openTerminal(configuration: ExternalTerminalConfiguration, cwd: string): Promise<void>;
|
|
6
|
-
getDefaultExec(): Promise<string>;
|
|
7
|
-
/**
|
|
8
|
-
* Spawn the external terminal for the given options.
|
|
9
|
-
* - The method spawns the terminal application based on the preferences, else uses the default value.
|
|
10
|
-
* @param configuration the preference configuration.
|
|
11
|
-
* @param cwd the optional current working directory to spawn from.
|
|
12
|
-
*/
|
|
13
|
-
protected spawnTerminal(configuration: ExternalTerminalConfiguration, cwd?: string): Promise<void>;
|
|
14
|
-
/**
|
|
15
|
-
* Get the default terminal application on Windows.
|
|
16
|
-
* - The following method uses environment variables to identify the best default possible value.
|
|
17
|
-
*
|
|
18
|
-
* @returns the default application on Windows.
|
|
19
|
-
*/
|
|
20
|
-
protected getDefaultTerminalWindows(): string;
|
|
21
|
-
/**
|
|
22
|
-
* Find the Windows Shell process to start up (defaults to cmd.exe).
|
|
23
|
-
*/
|
|
24
|
-
protected getWindowsShell(): string;
|
|
25
|
-
}
|
|
1
|
+
import { ExternalTerminalService, ExternalTerminalConfiguration } from '../common/external-terminal';
|
|
2
|
+
export declare class WindowsExternalTerminalService implements ExternalTerminalService {
|
|
3
|
+
protected readonly CMD = "cmd.exe";
|
|
4
|
+
protected DEFAULT_TERMINAL_WINDOWS: string;
|
|
5
|
+
openTerminal(configuration: ExternalTerminalConfiguration, cwd: string): Promise<void>;
|
|
6
|
+
getDefaultExec(): Promise<string>;
|
|
7
|
+
/**
|
|
8
|
+
* Spawn the external terminal for the given options.
|
|
9
|
+
* - The method spawns the terminal application based on the preferences, else uses the default value.
|
|
10
|
+
* @param configuration the preference configuration.
|
|
11
|
+
* @param cwd the optional current working directory to spawn from.
|
|
12
|
+
*/
|
|
13
|
+
protected spawnTerminal(configuration: ExternalTerminalConfiguration, cwd?: string): Promise<void>;
|
|
14
|
+
/**
|
|
15
|
+
* Get the default terminal application on Windows.
|
|
16
|
+
* - The following method uses environment variables to identify the best default possible value.
|
|
17
|
+
*
|
|
18
|
+
* @returns the default application on Windows.
|
|
19
|
+
*/
|
|
20
|
+
protected getDefaultTerminalWindows(): string;
|
|
21
|
+
/**
|
|
22
|
+
* Find the Windows Shell process to start up (defaults to cmd.exe).
|
|
23
|
+
*/
|
|
24
|
+
protected getWindowsShell(): string;
|
|
25
|
+
}
|
|
26
26
|
//# sourceMappingURL=windows-external-terminal-service.d.ts.map
|
|
@@ -1,108 +1,108 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2021 Ericsson and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
-
};
|
|
23
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
-
exports.WindowsExternalTerminalService = void 0;
|
|
25
|
-
const cp = require("child_process");
|
|
26
|
-
const path = require("path");
|
|
27
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
28
|
-
const file_uri_1 = require("@theia/core/lib/node/file-uri");
|
|
29
|
-
/*---------------------------------------------------------------------------------------------
|
|
30
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
31
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
32
|
-
*--------------------------------------------------------------------------------------------*/
|
|
33
|
-
// some code copied and modified from https://github.com/microsoft/vscode/blob/1.52.1/src/vs/workbench/contrib/externalTerminal/node/externalTerminalService.ts
|
|
34
|
-
let WindowsExternalTerminalService = class WindowsExternalTerminalService {
|
|
35
|
-
constructor() {
|
|
36
|
-
this.CMD = 'cmd.exe';
|
|
37
|
-
}
|
|
38
|
-
async openTerminal(configuration, cwd) {
|
|
39
|
-
await this.spawnTerminal(configuration, file_uri_1.FileUri.fsPath(cwd));
|
|
40
|
-
}
|
|
41
|
-
async getDefaultExec() {
|
|
42
|
-
return this.getDefaultTerminalWindows();
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Spawn the external terminal for the given options.
|
|
46
|
-
* - The method spawns the terminal application based on the preferences, else uses the default value.
|
|
47
|
-
* @param configuration the preference configuration.
|
|
48
|
-
* @param cwd the optional current working directory to spawn from.
|
|
49
|
-
*/
|
|
50
|
-
async spawnTerminal(configuration, cwd) {
|
|
51
|
-
// Use the executable value from the preferences if available, else fallback to the default.
|
|
52
|
-
const terminalConfig = configuration['terminal.external.windowsExec'];
|
|
53
|
-
const exec = terminalConfig || this.getDefaultTerminalWindows();
|
|
54
|
-
// Make the drive letter uppercase on Windows (https://github.com/microsoft/vscode/issues/9448).
|
|
55
|
-
if (cwd && cwd[1] === ':') {
|
|
56
|
-
cwd = cwd[0].toUpperCase() + cwd.substr(1);
|
|
57
|
-
}
|
|
58
|
-
// cmder ignores the environment cwd and instead opts to always open in %USERPROFILE%
|
|
59
|
-
// unless otherwise specified.
|
|
60
|
-
const basename = path.basename(exec).toLowerCase();
|
|
61
|
-
if (basename === 'cmder' || basename === 'cmder.exe') {
|
|
62
|
-
cp.spawn(exec, cwd ? [cwd] : undefined);
|
|
63
|
-
return;
|
|
64
|
-
}
|
|
65
|
-
const cmdArgs = ['/c', 'start', '/wait'];
|
|
66
|
-
// The "" argument is the window title. Without this, exec doesn't work when the path contains spaces.
|
|
67
|
-
if (exec.indexOf(' ') >= 0) {
|
|
68
|
-
cmdArgs.push('""');
|
|
69
|
-
}
|
|
70
|
-
cmdArgs.push(exec);
|
|
71
|
-
// Add starting directory parameter for Windows Terminal app.
|
|
72
|
-
if (basename === 'wt' || basename === 'wt.exe') {
|
|
73
|
-
cmdArgs.push('-d .');
|
|
74
|
-
}
|
|
75
|
-
return new Promise(async (resolve, reject) => {
|
|
76
|
-
const env = cwd ? { cwd } : undefined;
|
|
77
|
-
const command = this.getWindowsShell();
|
|
78
|
-
const child = cp.spawn(command, cmdArgs, env);
|
|
79
|
-
child.on('error', reject);
|
|
80
|
-
child.on('exit', resolve);
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* Get the default terminal application on Windows.
|
|
85
|
-
* - The following method uses environment variables to identify the best default possible value.
|
|
86
|
-
*
|
|
87
|
-
* @returns the default application on Windows.
|
|
88
|
-
*/
|
|
89
|
-
getDefaultTerminalWindows() {
|
|
90
|
-
if (!this.DEFAULT_TERMINAL_WINDOWS) {
|
|
91
|
-
const isWoW64 = !!process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432');
|
|
92
|
-
this.DEFAULT_TERMINAL_WINDOWS = `${process.env.windir ? process.env.windir : 'C:\\Windows'}\\${isWoW64 ? 'Sysnative' : 'System32'}\\cmd.exe`;
|
|
93
|
-
}
|
|
94
|
-
return this.DEFAULT_TERMINAL_WINDOWS;
|
|
95
|
-
}
|
|
96
|
-
/**
|
|
97
|
-
* Find the Windows Shell process to start up (defaults to cmd.exe).
|
|
98
|
-
*/
|
|
99
|
-
getWindowsShell() {
|
|
100
|
-
// Find the path to cmd.exe if possible (%compsec% environment variable).
|
|
101
|
-
return process.env.compsec || this.CMD;
|
|
102
|
-
}
|
|
103
|
-
};
|
|
104
|
-
WindowsExternalTerminalService = __decorate([
|
|
105
|
-
(0, inversify_1.injectable)()
|
|
106
|
-
], WindowsExternalTerminalService);
|
|
107
|
-
exports.WindowsExternalTerminalService = WindowsExternalTerminalService;
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2021 Ericsson and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
18
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
19
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
20
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
21
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
22
|
+
};
|
|
23
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
24
|
+
exports.WindowsExternalTerminalService = void 0;
|
|
25
|
+
const cp = require("child_process");
|
|
26
|
+
const path = require("path");
|
|
27
|
+
const inversify_1 = require("@theia/core/shared/inversify");
|
|
28
|
+
const file_uri_1 = require("@theia/core/lib/node/file-uri");
|
|
29
|
+
/*---------------------------------------------------------------------------------------------
|
|
30
|
+
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
31
|
+
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
32
|
+
*--------------------------------------------------------------------------------------------*/
|
|
33
|
+
// some code copied and modified from https://github.com/microsoft/vscode/blob/1.52.1/src/vs/workbench/contrib/externalTerminal/node/externalTerminalService.ts
|
|
34
|
+
let WindowsExternalTerminalService = class WindowsExternalTerminalService {
|
|
35
|
+
constructor() {
|
|
36
|
+
this.CMD = 'cmd.exe';
|
|
37
|
+
}
|
|
38
|
+
async openTerminal(configuration, cwd) {
|
|
39
|
+
await this.spawnTerminal(configuration, file_uri_1.FileUri.fsPath(cwd));
|
|
40
|
+
}
|
|
41
|
+
async getDefaultExec() {
|
|
42
|
+
return this.getDefaultTerminalWindows();
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Spawn the external terminal for the given options.
|
|
46
|
+
* - The method spawns the terminal application based on the preferences, else uses the default value.
|
|
47
|
+
* @param configuration the preference configuration.
|
|
48
|
+
* @param cwd the optional current working directory to spawn from.
|
|
49
|
+
*/
|
|
50
|
+
async spawnTerminal(configuration, cwd) {
|
|
51
|
+
// Use the executable value from the preferences if available, else fallback to the default.
|
|
52
|
+
const terminalConfig = configuration['terminal.external.windowsExec'];
|
|
53
|
+
const exec = terminalConfig || this.getDefaultTerminalWindows();
|
|
54
|
+
// Make the drive letter uppercase on Windows (https://github.com/microsoft/vscode/issues/9448).
|
|
55
|
+
if (cwd && cwd[1] === ':') {
|
|
56
|
+
cwd = cwd[0].toUpperCase() + cwd.substr(1);
|
|
57
|
+
}
|
|
58
|
+
// cmder ignores the environment cwd and instead opts to always open in %USERPROFILE%
|
|
59
|
+
// unless otherwise specified.
|
|
60
|
+
const basename = path.basename(exec).toLowerCase();
|
|
61
|
+
if (basename === 'cmder' || basename === 'cmder.exe') {
|
|
62
|
+
cp.spawn(exec, cwd ? [cwd] : undefined);
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
const cmdArgs = ['/c', 'start', '/wait'];
|
|
66
|
+
// The "" argument is the window title. Without this, exec doesn't work when the path contains spaces.
|
|
67
|
+
if (exec.indexOf(' ') >= 0) {
|
|
68
|
+
cmdArgs.push('""');
|
|
69
|
+
}
|
|
70
|
+
cmdArgs.push(exec);
|
|
71
|
+
// Add starting directory parameter for Windows Terminal app.
|
|
72
|
+
if (basename === 'wt' || basename === 'wt.exe') {
|
|
73
|
+
cmdArgs.push('-d .');
|
|
74
|
+
}
|
|
75
|
+
return new Promise(async (resolve, reject) => {
|
|
76
|
+
const env = cwd ? { cwd } : undefined;
|
|
77
|
+
const command = this.getWindowsShell();
|
|
78
|
+
const child = cp.spawn(command, cmdArgs, env);
|
|
79
|
+
child.on('error', reject);
|
|
80
|
+
child.on('exit', resolve);
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Get the default terminal application on Windows.
|
|
85
|
+
* - The following method uses environment variables to identify the best default possible value.
|
|
86
|
+
*
|
|
87
|
+
* @returns the default application on Windows.
|
|
88
|
+
*/
|
|
89
|
+
getDefaultTerminalWindows() {
|
|
90
|
+
if (!this.DEFAULT_TERMINAL_WINDOWS) {
|
|
91
|
+
const isWoW64 = !!process.env.hasOwnProperty('PROCESSOR_ARCHITEW6432');
|
|
92
|
+
this.DEFAULT_TERMINAL_WINDOWS = `${process.env.windir ? process.env.windir : 'C:\\Windows'}\\${isWoW64 ? 'Sysnative' : 'System32'}\\cmd.exe`;
|
|
93
|
+
}
|
|
94
|
+
return this.DEFAULT_TERMINAL_WINDOWS;
|
|
95
|
+
}
|
|
96
|
+
/**
|
|
97
|
+
* Find the Windows Shell process to start up (defaults to cmd.exe).
|
|
98
|
+
*/
|
|
99
|
+
getWindowsShell() {
|
|
100
|
+
// Find the path to cmd.exe if possible (%compsec% environment variable).
|
|
101
|
+
return process.env.compsec || this.CMD;
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
WindowsExternalTerminalService = __decorate([
|
|
105
|
+
(0, inversify_1.injectable)()
|
|
106
|
+
], WindowsExternalTerminalService);
|
|
107
|
+
exports.WindowsExternalTerminalService = WindowsExternalTerminalService;
|
|
108
108
|
//# sourceMappingURL=windows-external-terminal-service.js.map
|
package/lib/package.spec.js
CHANGED
|
@@ -1,26 +1,26 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2021 Ericsson and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
/* note: this bogus test file is required so that
|
|
17
|
-
we are able to run mocha unit tests on this
|
|
18
|
-
package, without having any actual unit tests in it.
|
|
19
|
-
This way a coverage report will be generated,
|
|
20
|
-
showing 0% coverage, instead of no report.
|
|
21
|
-
This file can be removed once we have real unit
|
|
22
|
-
tests in place. */
|
|
23
|
-
describe('external-terminal package', () => {
|
|
24
|
-
it('support code coverage statistics', () => true);
|
|
25
|
-
});
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2021 Ericsson and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
/* note: this bogus test file is required so that
|
|
17
|
+
we are able to run mocha unit tests on this
|
|
18
|
+
package, without having any actual unit tests in it.
|
|
19
|
+
This way a coverage report will be generated,
|
|
20
|
+
showing 0% coverage, instead of no report.
|
|
21
|
+
This file can be removed once we have real unit
|
|
22
|
+
tests in place. */
|
|
23
|
+
describe('external-terminal package', () => {
|
|
24
|
+
it('support code coverage statistics', () => true);
|
|
25
|
+
});
|
|
26
26
|
//# sourceMappingURL=package.spec.js.map
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/external-terminal",
|
|
3
|
-
"version": "1.34.
|
|
3
|
+
"version": "1.34.3",
|
|
4
4
|
"description": "Theia - External Terminal Extension",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/core": "1.34.
|
|
7
|
-
"@theia/editor": "1.34.
|
|
8
|
-
"@theia/workspace": "1.34.
|
|
6
|
+
"@theia/core": "1.34.3",
|
|
7
|
+
"@theia/editor": "1.34.3",
|
|
8
|
+
"@theia/workspace": "1.34.3"
|
|
9
9
|
},
|
|
10
10
|
"publishConfig": {
|
|
11
11
|
"access": "public"
|
|
@@ -41,10 +41,10 @@
|
|
|
41
41
|
"watch": "theiaext watch"
|
|
42
42
|
},
|
|
43
43
|
"devDependencies": {
|
|
44
|
-
"@theia/ext-scripts": "1.34.
|
|
44
|
+
"@theia/ext-scripts": "1.34.3"
|
|
45
45
|
},
|
|
46
46
|
"nyc": {
|
|
47
47
|
"extends": "../../configs/nyc.json"
|
|
48
48
|
},
|
|
49
|
-
"gitHead": "
|
|
49
|
+
"gitHead": "a6cf9fe96b1624d6e27a11dce2ebdeae820478e5"
|
|
50
50
|
}
|