@theia/core 1.77.0 → 1.78.0-next.19
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/lib/browser/catalog.json +208 -32
- package/lib/browser/encoding-registry.js +1 -1
- package/lib/browser/encoding-registry.js.map +1 -1
- package/lib/browser/encoding-registry.spec.d.ts +2 -0
- package/lib/browser/encoding-registry.spec.d.ts.map +1 -0
- package/lib/browser/encoding-registry.spec.js +43 -0
- package/lib/browser/encoding-registry.spec.js.map +1 -0
- package/lib/browser/messaging/service-connection-provider.d.ts.map +1 -1
- package/lib/browser/messaging/service-connection-provider.js +9 -1
- package/lib/browser/messaging/service-connection-provider.js.map +1 -1
- package/lib/browser/messaging/service-connection-provider.spec.d.ts +2 -0
- package/lib/browser/messaging/service-connection-provider.spec.d.ts.map +1 -0
- package/lib/browser/messaging/service-connection-provider.spec.js +76 -0
- package/lib/browser/messaging/service-connection-provider.spec.js.map +1 -0
- package/lib/browser/shell/tab-bars.d.ts +7 -0
- package/lib/browser/shell/tab-bars.d.ts.map +1 -1
- package/lib/browser/shell/tab-bars.js +25 -11
- package/lib/browser/shell/tab-bars.js.map +1 -1
- package/lib/browser/shell/tab-bars.spec.js +20 -0
- package/lib/browser/shell/tab-bars.spec.js.map +1 -1
- package/lib/common/core-preferences.d.ts +1 -0
- package/lib/common/core-preferences.d.ts.map +1 -1
- package/lib/common/core-preferences.js +11 -1
- package/lib/common/core-preferences.js.map +1 -1
- package/lib/common/messaging/handler.d.ts +11 -0
- package/lib/common/messaging/handler.d.ts.map +1 -1
- package/lib/common/messaging/proxy-factory.d.ts +8 -1
- package/lib/common/messaging/proxy-factory.d.ts.map +1 -1
- package/lib/common/messaging/proxy-factory.js +4 -2
- package/lib/common/messaging/proxy-factory.js.map +1 -1
- package/lib/common/messaging/proxy-factory.spec.js +16 -1
- package/lib/common/messaging/proxy-factory.spec.js.map +1 -1
- package/lib/common/shell-environment.d.ts +61 -0
- package/lib/common/shell-environment.d.ts.map +1 -0
- package/lib/common/shell-environment.js +29 -0
- package/lib/common/shell-environment.js.map +1 -0
- package/lib/electron-browser/shell-environment/electron-shell-environment-contribution.d.ts +20 -0
- package/lib/electron-browser/shell-environment/electron-shell-environment-contribution.d.ts.map +1 -0
- package/lib/electron-browser/shell-environment/electron-shell-environment-contribution.js +72 -0
- package/lib/electron-browser/shell-environment/electron-shell-environment-contribution.js.map +1 -0
- package/lib/electron-browser/shell-environment/electron-shell-environment-contribution.spec.d.ts +2 -0
- package/lib/electron-browser/shell-environment/electron-shell-environment-contribution.spec.d.ts.map +1 -0
- package/lib/electron-browser/shell-environment/electron-shell-environment-contribution.spec.js +86 -0
- package/lib/electron-browser/shell-environment/electron-shell-environment-contribution.spec.js.map +1 -0
- package/lib/electron-browser/shell-environment/electron-shell-environment-module.d.ts +4 -0
- package/lib/electron-browser/shell-environment/electron-shell-environment-module.d.ts.map +1 -0
- package/lib/electron-browser/shell-environment/electron-shell-environment-module.js +26 -0
- package/lib/electron-browser/shell-environment/electron-shell-environment-module.js.map +1 -0
- package/lib/electron-main/electron-main-application.d.ts.map +1 -1
- package/lib/electron-main/electron-main-application.js +12 -4
- package/lib/electron-main/electron-main-application.js.map +1 -1
- package/lib/electron-node/keyboard/electron-backend-keyboard-module.d.ts.map +1 -1
- package/lib/electron-node/keyboard/electron-backend-keyboard-module.js +1 -1
- package/lib/electron-node/keyboard/electron-backend-keyboard-module.js.map +1 -1
- package/lib/electron-node/request/electron-backend-request-service.d.ts +4 -1
- package/lib/electron-node/request/electron-backend-request-service.d.ts.map +1 -1
- package/lib/electron-node/request/electron-backend-request-service.js +56 -13
- package/lib/electron-node/request/electron-backend-request-service.js.map +1 -1
- package/lib/node/backend-application-module.d.ts.map +1 -1
- package/lib/node/backend-application-module.js +13 -5
- package/lib/node/backend-application-module.js.map +1 -1
- package/lib/node/env-variables/env-variables-server.d.ts +13 -3
- package/lib/node/env-variables/env-variables-server.d.ts.map +1 -1
- package/lib/node/env-variables/env-variables-server.js +21 -14
- package/lib/node/env-variables/env-variables-server.js.map +1 -1
- package/lib/node/env-variables/env-variables-server.spec.d.ts +2 -0
- package/lib/node/env-variables/env-variables-server.spec.d.ts.map +1 -0
- package/lib/node/env-variables/env-variables-server.spec.js +83 -0
- package/lib/node/env-variables/env-variables-server.spec.js.map +1 -0
- package/lib/node/i18n/i18n-backend-module.js +2 -2
- package/lib/node/i18n/i18n-backend-module.js.map +1 -1
- package/lib/node/index.d.ts +1 -0
- package/lib/node/index.d.ts.map +1 -1
- package/lib/node/index.js +1 -0
- package/lib/node/index.js.map +1 -1
- package/lib/node/logger-backend-module.js +1 -1
- package/lib/node/logger-backend-module.js.map +1 -1
- package/lib/node/messaging/connection-container-module.d.ts +11 -2
- package/lib/node/messaging/connection-container-module.d.ts.map +1 -1
- package/lib/node/messaging/connection-container-module.js +13 -2
- package/lib/node/messaging/connection-container-module.js.map +1 -1
- package/lib/node/messaging/connection-container-module.spec.d.ts +2 -0
- package/lib/node/messaging/connection-container-module.spec.d.ts.map +1 -0
- package/lib/node/messaging/connection-container-module.spec.js +37 -0
- package/lib/node/messaging/connection-container-module.spec.js.map +1 -0
- package/lib/node/messaging/default-messaging-service.d.ts +33 -4
- package/lib/node/messaging/default-messaging-service.d.ts.map +1 -1
- package/lib/node/messaging/default-messaging-service.js +52 -10
- package/lib/node/messaging/default-messaging-service.js.map +1 -1
- package/lib/node/messaging/gated-channel-multiplexer.d.ts +20 -0
- package/lib/node/messaging/gated-channel-multiplexer.d.ts.map +1 -0
- package/lib/node/messaging/gated-channel-multiplexer.js +50 -0
- package/lib/node/messaging/gated-channel-multiplexer.js.map +1 -0
- package/lib/node/messaging/gated-channel-multiplexer.spec.d.ts +2 -0
- package/lib/node/messaging/gated-channel-multiplexer.spec.d.ts.map +1 -0
- package/lib/node/messaging/gated-channel-multiplexer.spec.js +74 -0
- package/lib/node/messaging/gated-channel-multiplexer.spec.js.map +1 -0
- package/lib/node/messaging/index.d.ts +1 -0
- package/lib/node/messaging/index.d.ts.map +1 -1
- package/lib/node/messaging/index.js +1 -0
- package/lib/node/messaging/index.js.map +1 -1
- package/lib/node/messaging/messaging-backend-module.js +1 -1
- package/lib/node/messaging/messaging-backend-module.js.map +1 -1
- package/lib/node/messaging/messaging-service.d.ts +5 -1
- package/lib/node/messaging/messaging-service.d.ts.map +1 -1
- package/lib/node/messaging/messaging-service.js.map +1 -1
- package/lib/node/messaging/test/default-messaging-service.spec.js +82 -2
- package/lib/node/messaging/test/default-messaging-service.spec.js.map +1 -1
- package/lib/node/messaging/websocket-frontend-connection-service.d.ts +1 -0
- package/lib/node/messaging/websocket-frontend-connection-service.d.ts.map +1 -1
- package/lib/node/messaging/websocket-frontend-connection-service.js +8 -0
- package/lib/node/messaging/websocket-frontend-connection-service.js.map +1 -1
- package/lib/node/messaging/websocket-frontend-connection-service.spec.d.ts +2 -0
- package/lib/node/messaging/websocket-frontend-connection-service.spec.d.ts.map +1 -0
- package/lib/node/messaging/websocket-frontend-connection-service.spec.js +141 -0
- package/lib/node/messaging/websocket-frontend-connection-service.spec.js.map +1 -0
- package/lib/node/performance/measurement-backend-bindings.js +1 -1
- package/lib/node/performance/measurement-backend-bindings.js.map +1 -1
- package/lib/node/process-utils.d.ts +125 -2
- package/lib/node/process-utils.d.ts.map +1 -1
- package/lib/node/process-utils.js +297 -25
- package/lib/node/process-utils.js.map +1 -1
- package/lib/node/process-utils.slow-spec.js +78 -3
- package/lib/node/process-utils.slow-spec.js.map +1 -1
- package/lib/node/process-utils.spec.js +237 -2
- package/lib/node/process-utils.spec.js.map +1 -1
- package/lib/node/shell-environment.d.ts +107 -0
- package/lib/node/shell-environment.d.ts.map +1 -0
- package/lib/node/shell-environment.js +396 -0
- package/lib/node/shell-environment.js.map +1 -0
- package/lib/node/shell-environment.spec.d.ts +2 -0
- package/lib/node/shell-environment.spec.d.ts.map +1 -0
- package/lib/node/shell-environment.spec.js +348 -0
- package/lib/node/shell-environment.spec.js.map +1 -0
- package/lib/node/test/exiting-backend.d.ts +5 -0
- package/lib/node/test/exiting-backend.d.ts.map +1 -1
- package/lib/node/test/exiting-backend.js +16 -3
- package/lib/node/test/exiting-backend.js.map +1 -1
- package/package.json +7 -4
- package/src/browser/encoding-registry.spec.ts +48 -0
- package/src/browser/encoding-registry.ts +1 -1
- package/src/browser/messaging/service-connection-provider.spec.ts +88 -0
- package/src/browser/messaging/service-connection-provider.ts +9 -2
- package/src/browser/shell/tab-bars.spec.ts +22 -0
- package/src/browser/shell/tab-bars.ts +25 -12
- package/src/common/core-preferences.ts +12 -1
- package/src/common/messaging/handler.ts +11 -0
- package/src/common/messaging/proxy-factory.spec.ts +17 -1
- package/src/common/messaging/proxy-factory.ts +16 -2
- package/src/common/shell-environment.ts +81 -0
- package/src/electron-browser/shell-environment/electron-shell-environment-contribution.spec.ts +95 -0
- package/src/electron-browser/shell-environment/electron-shell-environment-contribution.ts +72 -0
- package/src/electron-browser/shell-environment/electron-shell-environment-module.ts +29 -0
- package/src/electron-main/electron-main-application.ts +15 -4
- package/src/electron-node/keyboard/electron-backend-keyboard-module.ts +2 -1
- package/src/electron-node/request/electron-backend-request-service.ts +59 -11
- package/src/node/backend-application-module.ts +19 -5
- package/src/node/env-variables/env-variables-server.spec.ts +93 -0
- package/src/node/env-variables/env-variables-server.ts +22 -14
- package/src/node/i18n/i18n-backend-module.ts +2 -2
- package/src/node/index.ts +1 -0
- package/src/node/logger-backend-module.ts +1 -1
- package/src/node/messaging/connection-container-module.spec.ts +39 -0
- package/src/node/messaging/connection-container-module.ts +16 -4
- package/src/node/messaging/default-messaging-service.ts +64 -10
- package/src/node/messaging/gated-channel-multiplexer.spec.ts +80 -0
- package/src/node/messaging/gated-channel-multiplexer.ts +52 -0
- package/src/node/messaging/index.ts +1 -0
- package/src/node/messaging/messaging-backend-module.ts +1 -1
- package/src/node/messaging/messaging-service.ts +5 -1
- package/src/node/messaging/test/default-messaging-service.spec.ts +89 -2
- package/src/node/messaging/websocket-frontend-connection-service.spec.ts +158 -0
- package/src/node/messaging/websocket-frontend-connection-service.ts +9 -0
- package/src/node/performance/measurement-backend-bindings.ts +1 -1
- package/src/node/process-utils.slow-spec.ts +90 -3
- package/src/node/process-utils.spec.ts +268 -3
- package/src/node/process-utils.ts +342 -24
- package/src/node/shell-environment.spec.ts +388 -0
- package/src/node/shell-environment.ts +406 -0
- package/src/node/test/exiting-backend.ts +17 -3
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2026 STMicroelectronics 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-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
var ShellEnvironmentServerImpl_1;
|
|
17
|
+
import { __decorate } from "tslib";
|
|
18
|
+
import { spawn } from 'child_process';
|
|
19
|
+
import { randomUUID } from 'crypto';
|
|
20
|
+
import { userInfo } from 'os';
|
|
21
|
+
import { basename } from 'path';
|
|
22
|
+
import { inject, injectable, named } from 'inversify';
|
|
23
|
+
import { environment } from '@theia/application-package/lib/environment';
|
|
24
|
+
import { ILogger } from '../common/logger.js';
|
|
25
|
+
import { Stopwatch } from '../common/performance/index.js';
|
|
26
|
+
import { ShellEnvironmentResolutionTimeout } from '../common/shell-environment.js';
|
|
27
|
+
import { SettingService } from './setting-service.js';
|
|
28
|
+
/**
|
|
29
|
+
* Thrown when the login shell does not answer within the resolution timeout.
|
|
30
|
+
*/
|
|
31
|
+
export class ShellEnvironmentTimeoutError extends Error {
|
|
32
|
+
constructor(timeout) {
|
|
33
|
+
super(`The login shell did not answer within ${timeout} seconds`);
|
|
34
|
+
this.timeout = timeout;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Resolves the environment of the user's login shell when the backend starts and applies its `PATH` to `process.env`,
|
|
39
|
+
* see {@link ShellEnvironmentServer}.
|
|
40
|
+
*
|
|
41
|
+
* The shell is run as an interactive login shell, so that it reads the same dotfiles as a terminal, and prints
|
|
42
|
+
* its environment as JSON by running this very executable as Node between two random markers, which keeps
|
|
43
|
+
* whatever the dotfiles print apart from the environment. This is how VS Code resolves the shell environment.
|
|
44
|
+
* The shell that hangs, for example on a prompt in the dotfiles, is killed with its process group when the
|
|
45
|
+
* timeout expires, or when the backend stops before that.
|
|
46
|
+
*/
|
|
47
|
+
let ShellEnvironmentServerImpl = class ShellEnvironmentServerImpl {
|
|
48
|
+
static { ShellEnvironmentServerImpl_1 = this; }
|
|
49
|
+
/**
|
|
50
|
+
* Set in the environment of the login shell, so that dotfiles can tell the resolution from a terminal session.
|
|
51
|
+
* A backend that finds it in its own environment was started by those dotfiles and does not resolve again.
|
|
52
|
+
*/
|
|
53
|
+
static { this.RESOLVING_VARIABLE = 'THEIA_RESOLVING_ENVIRONMENT'; }
|
|
54
|
+
initialize() {
|
|
55
|
+
// Start the login shell as early as possible, so that it runs while the rest of the start-up proceeds.
|
|
56
|
+
this.whenResolved();
|
|
57
|
+
}
|
|
58
|
+
onStop() {
|
|
59
|
+
// The timer that kills a hanging shell goes with the backend, and the shell would outlive it: a backend that
|
|
60
|
+
// exits abruptly only sends `SIGTERM` to its child processes, which an interactive shell ignores.
|
|
61
|
+
if (this.shell) {
|
|
62
|
+
this.logger.debug('Killing the login shell, which is still running while the backend stops.');
|
|
63
|
+
this.kill(this.shell);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
whenResolved() {
|
|
67
|
+
this.resolution ??= this.resolve();
|
|
68
|
+
return this.resolution;
|
|
69
|
+
}
|
|
70
|
+
async setResolutionTimeout(seconds) {
|
|
71
|
+
const value = seconds === undefined ? '' : String(seconds);
|
|
72
|
+
const stored = await this.settingService.get(ShellEnvironmentResolutionTimeout.PREFERENCE) ?? '';
|
|
73
|
+
if (stored !== value) {
|
|
74
|
+
await this.settingService.set(ShellEnvironmentResolutionTimeout.PREFERENCE, value);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
async resolve() {
|
|
78
|
+
const skipReason = this.getSkipReason();
|
|
79
|
+
if (skipReason) {
|
|
80
|
+
this.logger.debug(`Not resolving the login shell environment: ${skipReason}.`);
|
|
81
|
+
return { status: 'skipped', reason: skipReason };
|
|
82
|
+
}
|
|
83
|
+
try {
|
|
84
|
+
const timeout = await this.getResolutionTimeout();
|
|
85
|
+
const env = await this.stopwatch.startAsync('shell-environment', 'Resolving the login shell environment', () => this.resolveLoginShellEnvironment(timeout));
|
|
86
|
+
this.apply(this.sanitize(env));
|
|
87
|
+
return { status: 'applied' };
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
if (error instanceof ShellEnvironmentTimeoutError) {
|
|
91
|
+
this.logger.warn(`${error.message}, processes spawned by the backend may not find the user's tools. ` +
|
|
92
|
+
`The timeout is configured by the '${ShellEnvironmentResolutionTimeout.PREFERENCE}' preference.`);
|
|
93
|
+
return { status: 'timeout' };
|
|
94
|
+
}
|
|
95
|
+
const reason = error instanceof Error ? error.message : String(error);
|
|
96
|
+
this.logger.warn(`Could not resolve the login shell environment, processes spawned by the backend may not find the user's tools: ${reason}`);
|
|
97
|
+
return { status: 'failed', reason };
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Why the resolution does not apply to this backend, or `undefined` if it does.
|
|
102
|
+
*/
|
|
103
|
+
getSkipReason() {
|
|
104
|
+
if (process.platform === 'win32') {
|
|
105
|
+
return 'the application runs on Windows';
|
|
106
|
+
}
|
|
107
|
+
if (!environment.electron.is()) {
|
|
108
|
+
return 'the application is not an Electron application';
|
|
109
|
+
}
|
|
110
|
+
if (process.env[ShellEnvironmentServerImpl_1.RESOLVING_VARIABLE]) {
|
|
111
|
+
return 'the backend was started from the login shell that is being resolved';
|
|
112
|
+
}
|
|
113
|
+
return undefined;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* The time in seconds to wait for the login shell: the value that the frontend stored from the
|
|
117
|
+
* `application.shellEnvironmentResolutionTimeout` preference at an earlier start, or the default.
|
|
118
|
+
*/
|
|
119
|
+
async getResolutionTimeout() {
|
|
120
|
+
let stored;
|
|
121
|
+
try {
|
|
122
|
+
stored = await this.settingService.get(ShellEnvironmentResolutionTimeout.PREFERENCE);
|
|
123
|
+
}
|
|
124
|
+
catch (error) {
|
|
125
|
+
this.logger.warn('Could not read the resolution timeout of the login shell environment, using the default:', error);
|
|
126
|
+
}
|
|
127
|
+
const seconds = Number(stored);
|
|
128
|
+
if (!stored || !Number.isFinite(seconds)) {
|
|
129
|
+
return ShellEnvironmentResolutionTimeout.DEFAULT;
|
|
130
|
+
}
|
|
131
|
+
return Math.min(Math.max(seconds, ShellEnvironmentResolutionTimeout.MIN), ShellEnvironmentResolutionTimeout.MAX);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Runs the login shell and returns the environment that it prints, see {@link getShellArguments}.
|
|
135
|
+
*
|
|
136
|
+
* @param timeout the time in seconds after which a shell that is still running is killed. The result is then a
|
|
137
|
+
* {@link ShellEnvironmentTimeoutError}, unless the shell has printed its environment or exited already.
|
|
138
|
+
*/
|
|
139
|
+
resolveLoginShellEnvironment(timeout) {
|
|
140
|
+
const shell = this.getLoginShell();
|
|
141
|
+
const mark = randomUUID().replace(/-/g, '').substring(0, 12);
|
|
142
|
+
const args = this.getShellArguments(shell, mark);
|
|
143
|
+
this.logger.debug(`Resolving the login shell environment with ${shell} ${JSON.stringify(args)}`);
|
|
144
|
+
return new Promise((resolve, reject) => {
|
|
145
|
+
const child = spawn(shell, args, {
|
|
146
|
+
// Its own process group, so that the shell and whatever the dotfiles started can be killed together.
|
|
147
|
+
detached: process.platform !== 'win32',
|
|
148
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
149
|
+
env: this.getShellEnvironment(),
|
|
150
|
+
windowsHide: true
|
|
151
|
+
});
|
|
152
|
+
this.shell = child;
|
|
153
|
+
const stdout = [];
|
|
154
|
+
const stderr = [];
|
|
155
|
+
const output = () => Buffer.concat(stdout).toString('utf8');
|
|
156
|
+
let exit;
|
|
157
|
+
let settled = false;
|
|
158
|
+
const settle = (outcome) => {
|
|
159
|
+
if (!settled) {
|
|
160
|
+
settled = true;
|
|
161
|
+
clearTimeout(timer);
|
|
162
|
+
const errors = Buffer.concat(stderr).toString('utf8').trim();
|
|
163
|
+
if (errors) {
|
|
164
|
+
this.logger.debug(`The login shell printed to stderr:\n${errors}`);
|
|
165
|
+
}
|
|
166
|
+
outcome();
|
|
167
|
+
}
|
|
168
|
+
};
|
|
169
|
+
const complete = () => settle(() => {
|
|
170
|
+
if (exit?.code || exit?.signal) {
|
|
171
|
+
reject(new Error(`The login shell exited with ${exit.signal ? `signal ${exit.signal}` : `code ${exit.code}`}`));
|
|
172
|
+
}
|
|
173
|
+
else {
|
|
174
|
+
try {
|
|
175
|
+
resolve(this.parseEnvironment(output(), mark));
|
|
176
|
+
}
|
|
177
|
+
catch (error) {
|
|
178
|
+
reject(error);
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
});
|
|
182
|
+
// A program that the shell configuration started in the background without redirecting its output keeps the pipes
|
|
183
|
+
// open after the shell has exited, so the shell's 'close' may come much later than its 'exit', or never. The
|
|
184
|
+
// environment is taken as soon as the shell has exited and printed it, whichever comes last. After that, the output
|
|
185
|
+
// is still read but discarded, so that the program can go on writing to it.
|
|
186
|
+
const completeIfPrinted = () => {
|
|
187
|
+
if (exit && this.hasPrintedEnvironment(output(), mark)) {
|
|
188
|
+
complete();
|
|
189
|
+
}
|
|
190
|
+
};
|
|
191
|
+
const timer = setTimeout(() => {
|
|
192
|
+
if (exit || this.hasPrintedEnvironment(output(), mark)) {
|
|
193
|
+
// The shell has exited without printing its environment, or printed it but does not exit:
|
|
194
|
+
// report the outcome rather than the timeout.
|
|
195
|
+
complete();
|
|
196
|
+
}
|
|
197
|
+
else {
|
|
198
|
+
// Give up first, then kill: a program that the shell configuration started may have escaped the process
|
|
199
|
+
// group and keep the output open, in which case the shell never closes and nothing must wait for it.
|
|
200
|
+
settle(() => reject(new ShellEnvironmentTimeoutError(timeout)));
|
|
201
|
+
}
|
|
202
|
+
if (!exit) {
|
|
203
|
+
this.kill(child);
|
|
204
|
+
}
|
|
205
|
+
}, timeout * 1000);
|
|
206
|
+
child.stdout.on('data', chunk => {
|
|
207
|
+
if (!settled) {
|
|
208
|
+
stdout.push(chunk);
|
|
209
|
+
completeIfPrinted();
|
|
210
|
+
}
|
|
211
|
+
});
|
|
212
|
+
child.stderr.on('data', chunk => {
|
|
213
|
+
if (!settled) {
|
|
214
|
+
stderr.push(chunk);
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
child.on('error', error => settle(() => reject(error)));
|
|
218
|
+
child.on('exit', (code, signal) => {
|
|
219
|
+
// What the shell configuration started in the background is left running, and the PID may be reused.
|
|
220
|
+
this.shell = undefined;
|
|
221
|
+
exit = { code, signal };
|
|
222
|
+
if (code || signal) {
|
|
223
|
+
complete();
|
|
224
|
+
}
|
|
225
|
+
else {
|
|
226
|
+
// Otherwise, what the shell printed last may not have been read yet: wait for it, or for 'close'.
|
|
227
|
+
completeIfPrinted();
|
|
228
|
+
}
|
|
229
|
+
});
|
|
230
|
+
child.on('close', (code, signal) => {
|
|
231
|
+
exit ??= { code, signal };
|
|
232
|
+
complete();
|
|
233
|
+
});
|
|
234
|
+
});
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* The user's login shell: `$SHELL`, else the shell of the user account, else `/bin/sh`.
|
|
238
|
+
*/
|
|
239
|
+
getLoginShell() {
|
|
240
|
+
let shell = process.env.SHELL;
|
|
241
|
+
if (!shell) {
|
|
242
|
+
try {
|
|
243
|
+
shell = userInfo().shell ?? undefined;
|
|
244
|
+
}
|
|
245
|
+
catch {
|
|
246
|
+
// The account has no entry in the user database, see https://github.com/github/codespaces/issues/1639.
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
return shell && shell !== '/bin/false' ? shell : '/bin/sh';
|
|
250
|
+
}
|
|
251
|
+
/**
|
|
252
|
+
* The arguments that make the `shell` run as an interactive login shell and print its environment
|
|
253
|
+
* as JSON between two occurrences of the `mark`. The environment is printed by the `executable`, this one
|
|
254
|
+
* by default, running as Node, so that no shell builtin is involved and no value can be misread, however it is formatted.
|
|
255
|
+
* Xonsh, whose commands are Python, prints it with Python.
|
|
256
|
+
*/
|
|
257
|
+
getShellArguments(shell, mark, executable = process.execPath) {
|
|
258
|
+
const name = basename(shell);
|
|
259
|
+
if (/^(pwsh|powershell)(-preview)?$/.test(name)) {
|
|
260
|
+
// Older versions of PowerShell drop double quotes, so a single quote is escaped as two inside a single-quoted string.
|
|
261
|
+
return ['-Login', '-Command', `& '${executable.replace(/'/g, "''")}' -p '''${mark}'' + JSON.stringify(process.env) + ''${mark}'''`];
|
|
262
|
+
}
|
|
263
|
+
if (name === 'xonsh') {
|
|
264
|
+
return ['-i', '-l', '-c', `import os, json; print("${mark}", json.dumps(dict(os.environ)), "${mark}")`];
|
|
265
|
+
}
|
|
266
|
+
const script = `'"${mark}" + JSON.stringify(process.env) + "${mark}"'`;
|
|
267
|
+
if (name === 'nu') {
|
|
268
|
+
// Nushell runs a quoted path in command position only after a caret. Its single-quoted strings have no escapes,
|
|
269
|
+
// so a path that contains a single quote is put in a double-quoted string instead.
|
|
270
|
+
const quoted = executable.includes("'") ? `"${executable.replace(/[\\"]/g, '\\$&')}"` : `'${executable}'`;
|
|
271
|
+
return ['-i', '-l', '-c', `^${quoted} -p ${script}`];
|
|
272
|
+
}
|
|
273
|
+
// A single quote cannot be escaped inside a single-quoted string, so the string is closed around an escaped quote.
|
|
274
|
+
const command = `'${executable.replace(/'/g, "'\\''")}' -p ${script}`;
|
|
275
|
+
if (name === 'csh' || name === 'tcsh') {
|
|
276
|
+
return ['-ic', command];
|
|
277
|
+
}
|
|
278
|
+
return ['-i', '-l', '-c', command];
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* The environment to run the login shell in: the backend's own, plus the {@link getResolutionVariables resolution variables}.
|
|
282
|
+
*/
|
|
283
|
+
getShellEnvironment() {
|
|
284
|
+
return {
|
|
285
|
+
...process.env,
|
|
286
|
+
...this.getResolutionVariables()
|
|
287
|
+
};
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* The variables that are set in the environment of the login shell for the resolution: those that make the executable
|
|
291
|
+
* run as Node and that announce the resolution to the dotfiles. {@link sanitize} removes them from the result.
|
|
292
|
+
*/
|
|
293
|
+
getResolutionVariables() {
|
|
294
|
+
return {
|
|
295
|
+
// The executable is Electron in an Electron application; this makes it run as Node.
|
|
296
|
+
ELECTRON_RUN_AS_NODE: '1',
|
|
297
|
+
ELECTRON_NO_ATTACH_CONSOLE: '1',
|
|
298
|
+
[ShellEnvironmentServerImpl_1.RESOLVING_VARIABLE]: '1',
|
|
299
|
+
// Keep Oh My Zsh from waiting on its update prompt and its tmux plugin from replacing the shell with tmux.
|
|
300
|
+
DISABLE_AUTO_UPDATE: 'true',
|
|
301
|
+
ZSH_TMUX_AUTOSTART: 'false',
|
|
302
|
+
ZSH_TMUX_AUTOSTARTED: 'true'
|
|
303
|
+
};
|
|
304
|
+
}
|
|
305
|
+
/**
|
|
306
|
+
* Whether the `output` of the shell contains the environment between two occurrences of the `mark`, see {@link getShellArguments}.
|
|
307
|
+
*/
|
|
308
|
+
hasPrintedEnvironment(output, mark) {
|
|
309
|
+
const start = output.indexOf(mark);
|
|
310
|
+
return start >= 0 && output.indexOf(mark, start + mark.length) >= 0;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Extracts the environment that {@link getShellArguments} made the shell print from its `output`.
|
|
314
|
+
*/
|
|
315
|
+
parseEnvironment(output, mark) {
|
|
316
|
+
const start = output.indexOf(mark);
|
|
317
|
+
const end = start < 0 ? -1 : output.indexOf(mark, start + mark.length);
|
|
318
|
+
if (end < 0) {
|
|
319
|
+
this.logger.debug(`The login shell printed:\n${output}`);
|
|
320
|
+
throw new Error('The login shell did not print its environment; its shell configuration may have started another program');
|
|
321
|
+
}
|
|
322
|
+
try {
|
|
323
|
+
return JSON.parse(output.substring(start + mark.length, end));
|
|
324
|
+
}
|
|
325
|
+
catch (error) {
|
|
326
|
+
throw new Error(`The environment printed by the login shell could not be parsed: ${error instanceof Error ? error.message : error}`);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
/**
|
|
330
|
+
* Removes from the `env` that the login shell printed the {@link getResolutionVariables resolution variables},
|
|
331
|
+
* restoring the backend's own values of them.
|
|
332
|
+
*/
|
|
333
|
+
sanitize(env) {
|
|
334
|
+
const result = { ...env };
|
|
335
|
+
for (const key of Object.keys(this.getResolutionVariables())) {
|
|
336
|
+
if (process.env[key] === undefined) {
|
|
337
|
+
delete result[key];
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
result[key] = process.env[key];
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
return result;
|
|
344
|
+
}
|
|
345
|
+
/**
|
|
346
|
+
* Applies the `PATH` of the login shell to `process.env`, which is what the processes spawned by the backend need to find
|
|
347
|
+
* the user's tools. The other variables of the login shell are not applied; override this method to apply more of them.
|
|
348
|
+
*
|
|
349
|
+
* @param env the {@link sanitize sanitized} environment of the login shell. It holds whatever else the user's dotfiles
|
|
350
|
+
* define, so an override should choose the variables to apply rather than apply them all.
|
|
351
|
+
*/
|
|
352
|
+
apply(env) {
|
|
353
|
+
if (!env.PATH) {
|
|
354
|
+
throw new Error('The environment printed by the login shell does not define PATH');
|
|
355
|
+
}
|
|
356
|
+
process.env.PATH = env.PATH;
|
|
357
|
+
this.logger.debug(`Applied the PATH of the login shell to the backend: ${env.PATH}`);
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Kills the login shell that has not answered in time, or that is still running when the backend stops. An interactive
|
|
361
|
+
* shell ignores `SIGTERM`, and the dotfiles may have started processes of their own, so the whole process group is killed
|
|
362
|
+
* where there is one.
|
|
363
|
+
*/
|
|
364
|
+
kill(child) {
|
|
365
|
+
if (child.pid === undefined) {
|
|
366
|
+
return;
|
|
367
|
+
}
|
|
368
|
+
try {
|
|
369
|
+
if (process.platform === 'win32') {
|
|
370
|
+
child.kill();
|
|
371
|
+
}
|
|
372
|
+
else {
|
|
373
|
+
process.kill(-child.pid, 'SIGKILL');
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
catch (error) {
|
|
377
|
+
this.logger.debug(`Could not kill the process group of the login shell ${child.pid}, killing the shell alone:`, error);
|
|
378
|
+
child.kill('SIGKILL');
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
};
|
|
382
|
+
__decorate([
|
|
383
|
+
inject(ILogger),
|
|
384
|
+
named('core:ShellEnvironmentServerImpl')
|
|
385
|
+
], ShellEnvironmentServerImpl.prototype, "logger", void 0);
|
|
386
|
+
__decorate([
|
|
387
|
+
inject(SettingService)
|
|
388
|
+
], ShellEnvironmentServerImpl.prototype, "settingService", void 0);
|
|
389
|
+
__decorate([
|
|
390
|
+
inject(Stopwatch)
|
|
391
|
+
], ShellEnvironmentServerImpl.prototype, "stopwatch", void 0);
|
|
392
|
+
ShellEnvironmentServerImpl = ShellEnvironmentServerImpl_1 = __decorate([
|
|
393
|
+
injectable()
|
|
394
|
+
], ShellEnvironmentServerImpl);
|
|
395
|
+
export { ShellEnvironmentServerImpl };
|
|
396
|
+
//# sourceMappingURL=shell-environment.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":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