///
///
///
///
import * as child_process from 'child_process';
import { EnvironmentMap } from './EnvironmentMap';
/**
* Typings for one of the streams inside IExecutableSpawnSyncOptions.stdio.
* @public
*/
export type ExecutableStdioStreamMapping = 'pipe' | 'ignore' | 'inherit' | NodeJS.WritableStream | NodeJS.ReadableStream | number | undefined;
/**
* Types for {@link IExecutableSpawnSyncOptions.stdio}
* and {@link IExecutableSpawnOptions.stdio}
* @public
*/
export type ExecutableStdioMapping = 'pipe' | 'ignore' | 'inherit' | ExecutableStdioStreamMapping[];
/**
* Options for Executable.tryResolve().
* @public
*/
export interface IExecutableResolveOptions {
/**
* The current working directory. If omitted, process.cwd() will be used.
*/
currentWorkingDirectory?: string;
/**
* The environment variables for the child process.
*
* @remarks
* If `environment` and `environmentMap` are both omitted, then `process.env` will be used.
* If `environment` and `environmentMap` cannot both be specified.
*/
environment?: NodeJS.ProcessEnv;
/**
* The environment variables for the child process.
*
* @remarks
* If `environment` and `environmentMap` are both omitted, then `process.env` will be used.
* If `environment` and `environmentMap` cannot both be specified.
*/
environmentMap?: EnvironmentMap;
}
/**
* Options for {@link Executable.spawnSync}
* @public
*/
export interface IExecutableSpawnSyncOptions extends IExecutableResolveOptions {
/**
* The content to be passed to the child process's stdin.
*
* NOTE: If specified, this content replaces any IExecutableSpawnSyncOptions.stdio[0]
* mapping for stdin.
*/
input?: string;
/**
* The stdio mappings for the child process.
*
* NOTE: If IExecutableSpawnSyncOptions.input is provided, it will take precedence
* over the stdin mapping (stdio[0]).
*/
stdio?: ExecutableStdioMapping;
/**
* The maximum time the process is allowed to run before it will be terminated.
*/
timeoutMs?: number;
/**
* The largest amount of bytes allowed on stdout or stderr for this synchronous operation.
* If exceeded, the child process will be terminated. The default is 200 * 1024.
*/
maxBuffer?: number;
}
/**
* Options for {@link Executable.spawn}
* @public
*/
export interface IExecutableSpawnOptions extends IExecutableResolveOptions {
/**
* The stdio mappings for the child process.
*
* NOTE: If IExecutableSpawnSyncOptions.input is provided, it will take precedence
* over the stdin mapping (stdio[0]).
*/
stdio?: ExecutableStdioMapping;
}
/**
* The options for running a process to completion using {@link Executable.(waitForExitAsync:3)}.
*
* @public
*/
export interface IWaitForExitOptions {
/**
* Whether or not to throw when the process completes with a non-zero exit code. Defaults to false.
*/
throwOnNonZeroExitCode?: boolean;
/**
* The encoding of the output. If not provided, the output will not be collected.
*/
encoding?: BufferEncoding | 'buffer';
}
/**
* {@inheritDoc IWaitForExitOptions}
*
* @public
*/
export interface IWaitForExitWithStringOptions extends IWaitForExitOptions {
/**
* {@inheritDoc IWaitForExitOptions.encoding}
*/
encoding: BufferEncoding;
}
/**
* {@inheritDoc IWaitForExitOptions}
*
* @public
*/
export interface IWaitForExitWithBufferOptions extends IWaitForExitOptions {
/**
* {@inheritDoc IWaitForExitOptions.encoding}
*/
encoding: 'buffer';
}
/**
* The result of running a process to completion using {@link Executable.(waitForExitAsync:3)}.
*
* @public
*/
export interface IWaitForExitResult {
/**
* The process stdout output, if encoding was specified.
*/
stdout: T;
/**
* The process stderr output, if encoding was specified.
*/
stderr: T;
/**
* The process exit code. If the process was terminated, this will be null.
*/
exitCode: number | null;
}
/**
* Process information sourced from the system. This process info is sourced differently depending
* on the operating system:
* - On Windows, this uses the `wmic.exe` utility.
* - On Unix, this uses the `ps` utility.
*
* @public
*/
export interface IProcessInfo {
/**
* The name of the process.
*
* @remarks On Windows, the process name will be empty if the process is a kernel process.
* On Unix, the process name will be empty if the process is the root process.
*/
processName: string;
/**
* The process ID.
*/
processId: number;
/**
* The parent process info.
*
* @remarks On Windows, the parent process info will be undefined if the process is a kernel process.
* On Unix, the parent process info will be undefined if the process is the root process.
*/
parentProcessInfo: IProcessInfo | undefined;
/**
* The child process infos.
*/
childProcessInfos: IProcessInfo[];
}
export declare function parseProcessListOutputAsync(stream: NodeJS.ReadableStream): Promise