@theia/process 1.47.1 → 1.48.1

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.
Files changed (69) hide show
  1. package/README.md +30 -30
  2. package/lib/common/process-common-module.d.ts +3 -3
  3. package/lib/common/process-common-module.js +22 -22
  4. package/lib/common/process-manager-types.d.ts +35 -35
  5. package/lib/common/process-manager-types.js +23 -23
  6. package/lib/common/shell-command-builder.d.ts +49 -49
  7. package/lib/common/shell-command-builder.js +169 -169
  8. package/lib/common/shell-command-builder.slow-spec.d.ts +9 -9
  9. package/lib/common/shell-command-builder.slow-spec.js +404 -404
  10. package/lib/common/shell-quoting.d.ts +91 -91
  11. package/lib/common/shell-quoting.js +145 -145
  12. package/lib/common/shell-quoting.spec.d.ts +1 -1
  13. package/lib/common/shell-quoting.spec.js +170 -170
  14. package/lib/node/dev-null-stream.d.ts +17 -17
  15. package/lib/node/dev-null-stream.js +41 -41
  16. package/lib/node/index.d.ts +6 -6
  17. package/lib/node/index.js +24 -24
  18. package/lib/node/multi-ring-buffer.d.ts +68 -68
  19. package/lib/node/multi-ring-buffer.js +299 -299
  20. package/lib/node/multi-ring-buffer.spec.d.ts +1 -1
  21. package/lib/node/multi-ring-buffer.spec.js +422 -422
  22. package/lib/node/process-backend-module.d.ts +3 -3
  23. package/lib/node/process-backend-module.js +56 -56
  24. package/lib/node/process-manager.d.ts +33 -33
  25. package/lib/node/process-manager.js +102 -102
  26. package/lib/node/process.d.ts +95 -95
  27. package/lib/node/process.js +142 -142
  28. package/lib/node/pseudo-pty.d.ts +22 -22
  29. package/lib/node/pseudo-pty.js +38 -38
  30. package/lib/node/raw-process.d.ts +45 -45
  31. package/lib/node/raw-process.js +104 -104
  32. package/lib/node/raw-process.spec.d.ts +1 -1
  33. package/lib/node/raw-process.spec.js +164 -164
  34. package/lib/node/task-terminal-process.d.ts +10 -10
  35. package/lib/node/task-terminal-process.js +42 -42
  36. package/lib/node/terminal-process.d.ts +60 -60
  37. package/lib/node/terminal-process.js +248 -248
  38. package/lib/node/terminal-process.spec.d.ts +1 -1
  39. package/lib/node/terminal-process.spec.js +103 -103
  40. package/lib/node/test/process-test-container.d.ts +2 -2
  41. package/lib/node/test/process-test-container.js +28 -28
  42. package/lib/node/utils.d.ts +16 -16
  43. package/lib/node/utils.js +77 -77
  44. package/package.json +4 -4
  45. package/src/common/process-common-module.ts +22 -22
  46. package/src/common/process-manager-types.ts +58 -58
  47. package/src/common/shell-command-builder.slow-spec.ts +486 -486
  48. package/src/common/shell-command-builder.ts +187 -187
  49. package/src/common/shell-quoting.spec.ts +176 -176
  50. package/src/common/shell-quoting.ts +236 -236
  51. package/src/common/tests/$weird(),file=name.js +1 -1
  52. package/src/common/tests/white space.js +1 -1
  53. package/src/node/dev-null-stream.ts +47 -47
  54. package/src/node/index.ts +22 -22
  55. package/src/node/multi-ring-buffer.spec.ts +486 -486
  56. package/src/node/multi-ring-buffer.ts +348 -348
  57. package/src/node/process-backend-module.ts +67 -67
  58. package/src/node/process-manager.ts +107 -107
  59. package/src/node/process.ts +207 -207
  60. package/src/node/pseudo-pty.ts +54 -54
  61. package/src/node/raw-process.spec.ts +199 -199
  62. package/src/node/raw-process.ts +156 -156
  63. package/src/node/string-argv.d.ts +21 -21
  64. package/src/node/task-terminal-process.ts +41 -41
  65. package/src/node/terminal-process.spec.ts +121 -121
  66. package/src/node/terminal-process.ts +290 -290
  67. package/src/node/test/process-fork-test.js +22 -22
  68. package/src/node/test/process-test-container.ts +27 -27
  69. package/src/node/utils.ts +79 -79
package/README.md CHANGED
@@ -1,30 +1,30 @@
1
- <div align='center'>
2
-
3
- <br />
4
-
5
- <img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
6
-
7
- <h2>ECLIPSE THEIA - PROCESS EXTENSION</h2>
8
-
9
- <hr />
10
-
11
- </div>
12
-
13
- ## Description
14
-
15
- The `@theia/process` extension allows the management of processes started with or without a `terminal`.
16
-
17
- ## Additional Information
18
-
19
- - [API documentation for `@theia/process`](https://eclipse-theia.github.io/theia/docs/next/modules/process.html)
20
- - [Theia - GitHub](https://github.com/eclipse-theia/theia)
21
- - [Theia - Website](https://theia-ide.org/)
22
-
23
- ## License
24
-
25
- - [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
26
- - [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
27
-
28
- ## Trademark
29
- "Theia" is a trademark of the Eclipse Foundation
30
- https://www.eclipse.org/theia
1
+ <div align='center'>
2
+
3
+ <br />
4
+
5
+ <img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
6
+
7
+ <h2>ECLIPSE THEIA - PROCESS EXTENSION</h2>
8
+
9
+ <hr />
10
+
11
+ </div>
12
+
13
+ ## Description
14
+
15
+ The `@theia/process` extension allows the management of processes started with or without a `terminal`.
16
+
17
+ ## Additional Information
18
+
19
+ - [API documentation for `@theia/process`](https://eclipse-theia.github.io/theia/docs/next/modules/process.html)
20
+ - [Theia - GitHub](https://github.com/eclipse-theia/theia)
21
+ - [Theia - Website](https://theia-ide.org/)
22
+
23
+ ## License
24
+
25
+ - [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
26
+ - [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
27
+
28
+ ## Trademark
29
+ "Theia" is a trademark of the Eclipse Foundation
30
+ https://www.eclipse.org/theia
@@ -1,4 +1,4 @@
1
- import { ContainerModule } from '@theia/core/shared/inversify';
2
- declare const _default: ContainerModule;
3
- export default _default;
1
+ import { ContainerModule } from '@theia/core/shared/inversify';
2
+ declare const _default: ContainerModule;
3
+ export default _default;
4
4
  //# sourceMappingURL=process-common-module.d.ts.map
@@ -1,23 +1,23 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2020 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-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- const inversify_1 = require("@theia/core/shared/inversify");
19
- const shell_command_builder_1 = require("./shell-command-builder");
20
- exports.default = new inversify_1.ContainerModule((bind, unbind, isBound, rebind) => {
21
- bind(shell_command_builder_1.ShellCommandBuilder).toSelf().inSingletonScope();
22
- });
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2020 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-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ const inversify_1 = require("@theia/core/shared/inversify");
19
+ const shell_command_builder_1 = require("./shell-command-builder");
20
+ exports.default = new inversify_1.ContainerModule((bind, unbind, isBound, rebind) => {
21
+ bind(shell_command_builder_1.ShellCommandBuilder).toSelf().inSingletonScope();
22
+ });
23
23
  //# sourceMappingURL=process-common-module.js.map
@@ -1,36 +1,36 @@
1
- import { Event } from '@theia/core';
2
- export interface ManagedProcessManager {
3
- register(process: ManagedProcess): number;
4
- unregister(process: ManagedProcess): void;
5
- get(id: number): ManagedProcess | undefined;
6
- }
7
- export interface ManagedProcess {
8
- readonly id: number;
9
- readonly onStart: Event<IProcessStartEvent>;
10
- readonly onExit: Event<IProcessExitEvent>;
11
- readonly onClose: Event<IProcessExitEvent>;
12
- readonly onError: Event<ProcessErrorEvent>;
13
- readonly killed: boolean;
14
- kill(): void;
15
- }
16
- export interface IProcessExitEvent {
17
- readonly code?: number;
18
- readonly signal?: string;
19
- }
20
- /**
21
- * Data emitted when a process has been successfully started.
22
- */
23
- export interface IProcessStartEvent {
24
- }
25
- /**
26
- * Data emitted when a process has failed to start.
27
- */
28
- export interface ProcessErrorEvent extends Error {
29
- /** An errno-like error string (e.g. ENOENT). */
30
- code: string;
31
- }
32
- export declare enum ProcessType {
33
- 'Raw' = 0,
34
- 'Terminal' = 1
35
- }
1
+ import { Event } from '@theia/core';
2
+ export interface ManagedProcessManager {
3
+ register(process: ManagedProcess): number;
4
+ unregister(process: ManagedProcess): void;
5
+ get(id: number): ManagedProcess | undefined;
6
+ }
7
+ export interface ManagedProcess {
8
+ readonly id: number;
9
+ readonly onStart: Event<IProcessStartEvent>;
10
+ readonly onExit: Event<IProcessExitEvent>;
11
+ readonly onClose: Event<IProcessExitEvent>;
12
+ readonly onError: Event<ProcessErrorEvent>;
13
+ readonly killed: boolean;
14
+ kill(): void;
15
+ }
16
+ export interface IProcessExitEvent {
17
+ readonly code?: number;
18
+ readonly signal?: string;
19
+ }
20
+ /**
21
+ * Data emitted when a process has been successfully started.
22
+ */
23
+ export interface IProcessStartEvent {
24
+ }
25
+ /**
26
+ * Data emitted when a process has failed to start.
27
+ */
28
+ export interface ProcessErrorEvent extends Error {
29
+ /** An errno-like error string (e.g. ENOENT). */
30
+ code: string;
31
+ }
32
+ export declare enum ProcessType {
33
+ 'Raw' = 0,
34
+ 'Terminal' = 1
35
+ }
36
36
  //# sourceMappingURL=process-manager-types.d.ts.map
@@ -1,24 +1,24 @@
1
- "use strict";
2
- // *****************************************************************************
3
- // Copyright (C) 2022 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-only WITH Classpath-exception-2.0
16
- // *****************************************************************************
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.ProcessType = void 0;
19
- var ProcessType;
20
- (function (ProcessType) {
21
- ProcessType[ProcessType["Raw"] = 0] = "Raw";
22
- ProcessType[ProcessType["Terminal"] = 1] = "Terminal";
23
- })(ProcessType = exports.ProcessType || (exports.ProcessType = {}));
1
+ "use strict";
2
+ // *****************************************************************************
3
+ // Copyright (C) 2022 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-only WITH Classpath-exception-2.0
16
+ // *****************************************************************************
17
+ Object.defineProperty(exports, "__esModule", { value: true });
18
+ exports.ProcessType = void 0;
19
+ var ProcessType;
20
+ (function (ProcessType) {
21
+ ProcessType[ProcessType["Raw"] = 0] = "Raw";
22
+ ProcessType[ProcessType["Terminal"] = 1] = "Terminal";
23
+ })(ProcessType = exports.ProcessType || (exports.ProcessType = {}));
24
24
  //# sourceMappingURL=process-manager-types.js.map
@@ -1,50 +1,50 @@
1
- import { ShellQuotedString, ShellQuotingFunctions } from '../common/shell-quoting';
2
- export interface ProcessInfo {
3
- executable: string;
4
- arguments: string[];
5
- }
6
- export interface CommandLineOptions {
7
- cwd: string;
8
- args: string[];
9
- env?: {
10
- [key: string]: string | null;
11
- };
12
- }
13
- /**
14
- * Create command lines ready to be sent to a shell's stdin for evaluation.
15
- */
16
- export declare class ShellCommandBuilder {
17
- /**
18
- * Constructs a command line to run in a shell. The shell could be
19
- * re-used/long-lived, this means we cannot spawn a new process with a nice
20
- * and fresh environment, we need to encode environment modifications into
21
- * the returned command.
22
- *
23
- * Inspired by VS Code implementation, see:
24
- * https://github.com/microsoft/vscode/blob/f395cac4fff0721a8099126172c01411812bcb4a/src/vs/workbench/contrib/debug/node/terminals.ts#L79
25
- *
26
- * @param hostProcessInfo the host terminal process infos
27
- * @param commandOptions program to execute in the host terminal
28
- */
29
- buildCommand(hostProcessInfo: ProcessInfo | undefined, commandOptions: CommandLineOptions): string;
30
- protected buildForBash(args: Array<string | ShellQuotedString>, cwd?: string, env?: Array<[string, string | null]>): string;
31
- protected buildForPowershell(args: Array<string | ShellQuotedString>, cwd?: string, env?: Array<[string, string | null]>): string;
32
- protected buildForCmd(args: Array<string | ShellQuotedString>, cwd?: string, env?: Array<[string, string | null]>): string;
33
- protected buildForDefault(args: Array<string | ShellQuotedString>, cwd?: string, env?: Array<[string, string | null]>): string;
34
- /**
35
- * This method will try to leave `arg[0]` unescaped if possible. The reason
36
- * is that shells like `cmd` expect their own commands like `dir` to be
37
- * unescaped.
38
- *
39
- * @returns empty string if `args` is empty, otherwise an escaped command.
40
- */
41
- protected createShellCommandLine(args: (string | ShellQuotedString)[], quotingFunctions: ShellQuotingFunctions): string;
42
- protected quoteExecutableIfNecessary(exec: string | ShellQuotedString, quotingFunctions: ShellQuotingFunctions): string;
43
- /**
44
- * If this method returns `false` then we definitely need quoting.
45
- *
46
- * May return false positives.
47
- */
48
- protected needsQuoting(arg: string): boolean;
49
- }
1
+ import { ShellQuotedString, ShellQuotingFunctions } from '../common/shell-quoting';
2
+ export interface ProcessInfo {
3
+ executable: string;
4
+ arguments: string[];
5
+ }
6
+ export interface CommandLineOptions {
7
+ cwd: string;
8
+ args: string[];
9
+ env?: {
10
+ [key: string]: string | null;
11
+ };
12
+ }
13
+ /**
14
+ * Create command lines ready to be sent to a shell's stdin for evaluation.
15
+ */
16
+ export declare class ShellCommandBuilder {
17
+ /**
18
+ * Constructs a command line to run in a shell. The shell could be
19
+ * re-used/long-lived, this means we cannot spawn a new process with a nice
20
+ * and fresh environment, we need to encode environment modifications into
21
+ * the returned command.
22
+ *
23
+ * Inspired by VS Code implementation, see:
24
+ * https://github.com/microsoft/vscode/blob/f395cac4fff0721a8099126172c01411812bcb4a/src/vs/workbench/contrib/debug/node/terminals.ts#L79
25
+ *
26
+ * @param hostProcessInfo the host terminal process infos
27
+ * @param commandOptions program to execute in the host terminal
28
+ */
29
+ buildCommand(hostProcessInfo: ProcessInfo | undefined, commandOptions: CommandLineOptions): string;
30
+ protected buildForBash(args: Array<string | ShellQuotedString>, cwd?: string, env?: Array<[string, string | null]>): string;
31
+ protected buildForPowershell(args: Array<string | ShellQuotedString>, cwd?: string, env?: Array<[string, string | null]>): string;
32
+ protected buildForCmd(args: Array<string | ShellQuotedString>, cwd?: string, env?: Array<[string, string | null]>): string;
33
+ protected buildForDefault(args: Array<string | ShellQuotedString>, cwd?: string, env?: Array<[string, string | null]>): string;
34
+ /**
35
+ * This method will try to leave `arg[0]` unescaped if possible. The reason
36
+ * is that shells like `cmd` expect their own commands like `dir` to be
37
+ * unescaped.
38
+ *
39
+ * @returns empty string if `args` is empty, otherwise an escaped command.
40
+ */
41
+ protected createShellCommandLine(args: (string | ShellQuotedString)[], quotingFunctions: ShellQuotingFunctions): string;
42
+ protected quoteExecutableIfNecessary(exec: string | ShellQuotedString, quotingFunctions: ShellQuotingFunctions): string;
43
+ /**
44
+ * If this method returns `false` then we definitely need quoting.
45
+ *
46
+ * May return false positives.
47
+ */
48
+ protected needsQuoting(arg: string): boolean;
49
+ }
50
50
  //# sourceMappingURL=shell-command-builder.d.ts.map