processes.ts ×5

Frontier kind: Code frontier

unlabeled · c_563270910eb4

1128 tests · 7473 LOC · 36 files · introduces 0 tests · 45 LOC · 1 file

Introduces — evidence that enters the hierarchy at this concept

Code
5 ranges45 lines · 1 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
1057 ranges7473 lines · 36 files · Browse complete extent
All tests (intent)
1128 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: 45 introduced LOC across 5 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

src/vs/base/node/processes.ts 45 introduced LOC · 5 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 * as cp from 'child_process';
7 > import { Stats, promises } from 'fs';
8 > import { getCaseInsensitive } from '../common/objects.js';
9 > import * as path from '../common/path.js';
10 > import * as Platform from '../common/platform.js';
11 > import * as processCommon from '../common/process.js';
12 > import { CommandOptions, ForkOptions, Source, SuccessData, TerminateResponse, TerminateResponseCode } from '../common/processes.js';
13 > import * as Types from '../common/types.js';
14 > import * as pfs from './pfs.js';
15 > import { FileAccess } from '../common/network.js';
16 > import Stream from 'stream';
17 > export { Source, TerminateResponseCode, type CommandOptions, type ForkOptions, type SuccessData, type TerminateResponse };
18 >
19 > export type ValueCallback<T> = (value: T | Promise<T>) => void;
20 > export type ErrorCallback = (error?: any) => void;
21 > export type ProgressCallback<T> = (progress: T) => void;
22 >
23 >
24 > export function getWindowsShell(env = processCommon.env): string {
25 return env['comspec'] || 'cmd.exe';
26 }
28 > export interface IQueuedSender {
29 > send: (msg: any) => void;
30 > }
31 >
32 > // Wrapper around process.send() that will queue any messages if the internal node.js
33 > // queue is filled with messages and only continue sending messages when the internal
34 > // queue is free again to consume messages.
35 > // On Windows we always wait for the send() method to return before sending the next message
36 > // to workaround https://github.com/nodejs/node/issues/7657 (IPC can freeze process)
37 > export function createQueuedSender(childProcess: cp.ChildProcess): IQueuedSender {
38 let msgQueue: string[] = [];
39 let useQueue = false;
67 return { send };
68 }
70 async function fileExistsDefault(path: string): Promise<boolean> {
71 if (await pfs.Promises.exists(path)) {
83 return false;
84 }
86 export async function findExecutable(command: string, cwd?: string, paths?: string[], env: Platform.IProcessEnvironment = processCommon.env, fileExists: (path: string) => Promise<boolean> = fileExistsDefault): Promise<string | undefined> {
87 // If we have an absolute path then we take it.
140 return await fileExists(fullPath) ? fullPath : undefined;
141 }
142 > processes.ts
143 > /**
144 > * Kills a process and all its children.
145 > * @param pid the process id to kill
146 > * @param forceful whether to forcefully kill the process (default: false). Note
147 > * that on Windows, terminal processes can _only_ be killed forcefully and this
148 > * will throw when not forceful.
149 > */
150 export async function killTree(pid: number, forceful = false) {
151 let child: cp.ChildProcessByStdio<null, Stream.Readable, Stream.Readable>;