processes.ts ×2

Frontier kind: Code frontier

unlabeled · c_63abf9e82680

1173 tests · 3490 LOC · 19 files · introduces 0 tests · 112 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
2 ranges112 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
482 ranges3490 lines · 19 files · Browse complete extent
All tests (intent)
1173 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

1 file ranked by introduced lines: 112 introduced LOC across 2 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/base/common/processes.ts 112 introduced LOC · 2 ranges

Open complete file

1 > /*--------------------------------------------------------------------------------------------- processes.ts
2 > * Copyright (c) Microsoft Corporation. All rights reserved.
3 > * Licensed under the MIT License. See License.txt in the project root for license information.
4 > *--------------------------------------------------------------------------------------------*/
5 >
6 > import { IProcessEnvironment, isLinux } from './platform.js';
7 >
8 > /**
9 > * Options to be passed to the external program or shell.
10 > */
11 > export interface CommandOptions {
12 > /**
13 > * The current working directory of the executed program or shell.
14 > * If omitted VSCode's current workspace root is used.
15 > */
16 > cwd?: string;
17 >
18 > /**
19 > * The environment of the executed program or shell. If omitted
20 > * the parent process' environment is used.
21 > */
22 > env?: { [key: string]: string };
23 > }
24 >
25 > export interface Executable {
26 > /**
27 > * The command to be executed. Can be an external program or a shell
28 > * command.
29 > */
30 > command: string;
31 >
32 > /**
33 > * Specifies whether the command is a shell command and therefore must
34 > * be executed in a shell interpreter (e.g. cmd.exe, bash, ...).
35 > */
36 > isShellCommand: boolean;
37 >
38 > /**
39 > * The arguments passed to the command.
40 > */
41 > args: string[];
42 >
43 > /**
44 > * The command options used when the command is executed. Can be omitted.
45 > */
46 > options?: CommandOptions;
47 > }
48 >
49 > export interface ForkOptions extends CommandOptions {
50 > execArgv?: string[];
51 > }
52 >
53 > export const enum Source {
54 > stdout,
55 > stderr
56 > }
57 >
58 > /**
59 > * The data send via a success callback
60 > */
61 > export interface SuccessData {
62 > error?: Error;
63 > cmdCode?: number;
64 > terminated?: boolean;
65 > }
66 >
67 > /**
68 > * The data send via a error callback
69 > */
70 > export interface ErrorData {
71 > error?: Error;
72 > terminated?: boolean;
73 > stdout?: string;
74 > stderr?: string;
75 > }
76 >
77 > export interface TerminateResponse {
78 > success: boolean;
79 > code?: TerminateResponseCode;
80 > error?: any;
81 > }
82 >
83 > export const enum TerminateResponseCode {
84 > Success = 0,
85 > Unknown = 1,
86 > AccessDenied = 2,
87 > ProcessNotFound = 3,
88 > }
89 >
90 > export interface ProcessItem {
91 > name: string;
92 > cmd: string;
93 > pid: number;
94 > ppid: number;
95 > load: number;
96 > mem: number;
97 >
98 > children?: ProcessItem[];
99 > }
100 >
101 > /**
102 > * Sanitizes a VS Code process environment by removing all Electron/VS Code-related values.
103 > */
104 > export function sanitizeProcessEnvironment(env: IProcessEnvironment, ...preserve: string[]): void {
105 const set = preserve.reduce<Record<string, boolean>>((set, key) => {
106 set[key] = true;
125 });
126 }
127 > processes.ts
128 > /**
129 > * Remove dangerous environment variables that have caused crashes
130 > * in forked processes (i.e. in ELECTRON_RUN_AS_NODE processes)
131 > *
132 > * @param env The env object to change
133 > */
134 > export function removeDangerousEnvVariables(env: IProcessEnvironment | undefined): void {
135 if (!env) {
136 return;