@theia/process 1.48.1 → 1.48.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/README.md +30 -30
- package/lib/common/process-common-module.d.ts +3 -3
- package/lib/common/process-common-module.js +22 -22
- package/lib/common/process-manager-types.d.ts +35 -35
- package/lib/common/process-manager-types.js +23 -23
- package/lib/common/shell-command-builder.d.ts +49 -49
- package/lib/common/shell-command-builder.js +169 -169
- package/lib/common/shell-command-builder.slow-spec.d.ts +9 -9
- package/lib/common/shell-command-builder.slow-spec.js +404 -404
- package/lib/common/shell-quoting.d.ts +91 -91
- package/lib/common/shell-quoting.js +145 -145
- package/lib/common/shell-quoting.spec.d.ts +1 -1
- package/lib/common/shell-quoting.spec.js +170 -170
- package/lib/node/dev-null-stream.d.ts +17 -17
- package/lib/node/dev-null-stream.js +41 -41
- package/lib/node/index.d.ts +6 -6
- package/lib/node/index.js +24 -24
- package/lib/node/multi-ring-buffer.d.ts +68 -68
- package/lib/node/multi-ring-buffer.js +299 -299
- package/lib/node/multi-ring-buffer.spec.d.ts +1 -1
- package/lib/node/multi-ring-buffer.spec.js +422 -422
- package/lib/node/process-backend-module.d.ts +3 -3
- package/lib/node/process-backend-module.js +56 -56
- package/lib/node/process-manager.d.ts +33 -33
- package/lib/node/process-manager.js +102 -102
- package/lib/node/process.d.ts +95 -95
- package/lib/node/process.js +142 -142
- package/lib/node/pseudo-pty.d.ts +22 -22
- package/lib/node/pseudo-pty.js +38 -38
- package/lib/node/raw-process.d.ts +45 -45
- package/lib/node/raw-process.js +104 -104
- package/lib/node/raw-process.spec.d.ts +1 -1
- package/lib/node/raw-process.spec.js +164 -164
- package/lib/node/task-terminal-process.d.ts +10 -10
- package/lib/node/task-terminal-process.js +42 -42
- package/lib/node/terminal-process.d.ts +60 -60
- package/lib/node/terminal-process.js +248 -248
- package/lib/node/terminal-process.spec.d.ts +1 -1
- package/lib/node/terminal-process.spec.js +103 -103
- package/lib/node/test/process-test-container.d.ts +2 -2
- package/lib/node/test/process-test-container.js +28 -28
- package/lib/node/utils.d.ts +16 -16
- package/lib/node/utils.js +77 -77
- package/package.json +4 -4
- package/src/common/process-common-module.ts +22 -22
- package/src/common/process-manager-types.ts +58 -58
- package/src/common/shell-command-builder.slow-spec.ts +486 -486
- package/src/common/shell-command-builder.ts +187 -187
- package/src/common/shell-quoting.spec.ts +176 -176
- package/src/common/shell-quoting.ts +236 -236
- package/src/common/tests/$weird(),file=name.js +1 -1
- package/src/common/tests/white space.js +1 -1
- package/src/node/dev-null-stream.ts +47 -47
- package/src/node/index.ts +22 -22
- package/src/node/multi-ring-buffer.spec.ts +486 -486
- package/src/node/multi-ring-buffer.ts +348 -348
- package/src/node/process-backend-module.ts +67 -67
- package/src/node/process-manager.ts +107 -107
- package/src/node/process.ts +207 -207
- package/src/node/pseudo-pty.ts +54 -54
- package/src/node/raw-process.spec.ts +199 -199
- package/src/node/raw-process.ts +156 -156
- package/src/node/string-argv.d.ts +21 -21
- package/src/node/task-terminal-process.ts +41 -41
- package/src/node/terminal-process.spec.ts +121 -121
- package/src/node/terminal-process.ts +290 -290
- package/src/node/test/process-fork-test.js +22 -22
- package/src/node/test/process-test-container.ts +27 -27
- package/src/node/utils.ts +79 -79
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2017 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-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
import { Container } from '@theia/core/shared/inversify';
|
|
17
|
-
import { bindLogger } from '@theia/core/lib/node/logger-backend-module';
|
|
18
|
-
import processBackendModule from '../process-backend-module';
|
|
19
|
-
|
|
20
|
-
export function createProcessTestContainer(): Container {
|
|
21
|
-
const testContainer = new Container();
|
|
22
|
-
|
|
23
|
-
bindLogger(testContainer.bind.bind(testContainer));
|
|
24
|
-
testContainer.load(processBackendModule);
|
|
25
|
-
|
|
26
|
-
return testContainer;
|
|
27
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2017 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-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
import { Container } from '@theia/core/shared/inversify';
|
|
17
|
+
import { bindLogger } from '@theia/core/lib/node/logger-backend-module';
|
|
18
|
+
import processBackendModule from '../process-backend-module';
|
|
19
|
+
|
|
20
|
+
export function createProcessTestContainer(): Container {
|
|
21
|
+
const testContainer = new Container();
|
|
22
|
+
|
|
23
|
+
bindLogger(testContainer.bind.bind(testContainer));
|
|
24
|
+
testContainer.load(processBackendModule);
|
|
25
|
+
|
|
26
|
+
return testContainer;
|
|
27
|
+
}
|
package/src/node/utils.ts
CHANGED
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2017 TypeFox 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
|
-
|
|
17
|
-
import { isWindows } from '@theia/core';
|
|
18
|
-
import * as os from 'os';
|
|
19
|
-
const stringArgv = require('string-argv');
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Parses the given line into an array of args respecting escapes and string literals.
|
|
23
|
-
* @param line the given line to parse
|
|
24
|
-
*/
|
|
25
|
-
export function parseArgs(line: string | undefined): string[] {
|
|
26
|
-
if (line) {
|
|
27
|
-
return stringArgv(line);
|
|
28
|
-
}
|
|
29
|
-
return [];
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
// Polyfill for Object.entries, until we upgrade to ES2017.
|
|
33
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
|
-
function objectEntries(obj: any): any[] {
|
|
35
|
-
const props = Object.keys(obj);
|
|
36
|
-
const result = new Array(props.length);
|
|
37
|
-
for (let i = 0; i < props.length; i++) {
|
|
38
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
|
-
result[i] = [props[i], obj[props[i]]];
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
return result;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* Convert a signal number to its short name (using the signal definitions of
|
|
47
|
-
* the current host). Should never be called on Windows. For Linux, this is
|
|
48
|
-
* only valid for the x86 and ARM architectures, since other architectures may
|
|
49
|
-
* use different numbers, see signal(7).
|
|
50
|
-
*/
|
|
51
|
-
export function signame(sig: number): string {
|
|
52
|
-
// We should never reach this on Windows, since signals are not a thing
|
|
53
|
-
// there.
|
|
54
|
-
if (isWindows) {
|
|
55
|
-
throw new Error('Trying to get a signal name on Windows.');
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
for (const entry of objectEntries(os.constants.signals)) {
|
|
59
|
-
if (entry[1] === sig) {
|
|
60
|
-
return entry[0];
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
// Don't know this signal? Return the number as a string.
|
|
65
|
-
return sig.toString(10);
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* Convert a code number to its short name
|
|
70
|
-
*/
|
|
71
|
-
export function codename(code: number): string {
|
|
72
|
-
for (const entry of objectEntries(os.constants.errno)) {
|
|
73
|
-
if (entry[1] === code) {
|
|
74
|
-
return entry[0];
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
// Return the number as string if we did not find a name for it.
|
|
78
|
-
return code.toString(10);
|
|
79
|
-
}
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2017 TypeFox 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
|
+
|
|
17
|
+
import { isWindows } from '@theia/core';
|
|
18
|
+
import * as os from 'os';
|
|
19
|
+
const stringArgv = require('string-argv');
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Parses the given line into an array of args respecting escapes and string literals.
|
|
23
|
+
* @param line the given line to parse
|
|
24
|
+
*/
|
|
25
|
+
export function parseArgs(line: string | undefined): string[] {
|
|
26
|
+
if (line) {
|
|
27
|
+
return stringArgv(line);
|
|
28
|
+
}
|
|
29
|
+
return [];
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// Polyfill for Object.entries, until we upgrade to ES2017.
|
|
33
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
34
|
+
function objectEntries(obj: any): any[] {
|
|
35
|
+
const props = Object.keys(obj);
|
|
36
|
+
const result = new Array(props.length);
|
|
37
|
+
for (let i = 0; i < props.length; i++) {
|
|
38
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
39
|
+
result[i] = [props[i], obj[props[i]]];
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return result;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Convert a signal number to its short name (using the signal definitions of
|
|
47
|
+
* the current host). Should never be called on Windows. For Linux, this is
|
|
48
|
+
* only valid for the x86 and ARM architectures, since other architectures may
|
|
49
|
+
* use different numbers, see signal(7).
|
|
50
|
+
*/
|
|
51
|
+
export function signame(sig: number): string {
|
|
52
|
+
// We should never reach this on Windows, since signals are not a thing
|
|
53
|
+
// there.
|
|
54
|
+
if (isWindows) {
|
|
55
|
+
throw new Error('Trying to get a signal name on Windows.');
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
for (const entry of objectEntries(os.constants.signals)) {
|
|
59
|
+
if (entry[1] === sig) {
|
|
60
|
+
return entry[0];
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Don't know this signal? Return the number as a string.
|
|
65
|
+
return sig.toString(10);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/**
|
|
69
|
+
* Convert a code number to its short name
|
|
70
|
+
*/
|
|
71
|
+
export function codename(code: number): string {
|
|
72
|
+
for (const entry of objectEntries(os.constants.errno)) {
|
|
73
|
+
if (entry[1] === code) {
|
|
74
|
+
return entry[0];
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
// Return the number as string if we did not find a name for it.
|
|
78
|
+
return code.toString(10);
|
|
79
|
+
}
|