@ionic/utils-subprocess
- Version 3.0.1
- Published
- 14.9 kB
- 8 dependencies
- MIT license
Install
npm i @ionic/utils-subprocess
yarn add @ionic/utils-subprocess
pnpm add @ionic/utils-subprocess
Overview
Subprocess utils for NodeJS
Index
Variables
Functions
Classes
Interfaces
Variables
variable ERROR_COMMAND_NOT_FOUND
const ERROR_COMMAND_NOT_FOUND: string;
variable ERROR_NON_ZERO_EXIT
const ERROR_NON_ZERO_EXIT: string;
variable ERROR_SIGNAL_EXIT
const ERROR_SIGNAL_EXIT: string;
variable TILDE_PATH_REGEX
const TILDE_PATH_REGEX: RegExp;
Functions
function convertPATH
convertPATH: (path?: string) => string;
Prepare the PATH environment variable for use with subprocesses.
If a raw tilde is found in PATH, e.g.
~/.bin
, it is expanded. The raw tilde works in Bash, but not in Node'schild_process
outside of a shell.This is a utility method. You do not need to use it with
Subprocess
.Parameter path
Defaults to
process.env.PATH
function expandTildePath
expandTildePath: (p: string) => string;
function findExecutables
findExecutables: ( program: string, { PATH, PATHEXT }?: WhichOptions) => Promise<string[]>;
Find all instances of a program in PATH.
If
program
contains a path separator, this function will merely return it inside an array.Parameter program
A command name, such as
ionic
function fork
fork: ( modulePath: string, args?: readonly string[], options?: ForkOptions & Pick<SpawnOptions, 'stdio'>) => ChildProcess;
function spawn
spawn: ( command: string, args?: readonly string[], options?: SpawnOptions) => ChildProcess;
function which
which: (program: string, { PATH, PATHEXT }?: WhichOptions) => Promise<string>;
Find the first instance of a program in PATH.
If
program
contains a path separator, this function will merely return it.Parameter program
A command name, such as
ionic
Classes
class Subprocess
class Subprocess {}
constructor
constructor(name: string, args: readonly string[], options?: SubprocessOptions);
property args
args: readonly string[];
property name
name: string;
property options
readonly options: SpawnOptions;
property path
protected readonly path?: string;
method bashify
bashify: ({ maskArgv0, maskArgv1, shiftArgv0,}?: SubprocessBashifyOptions) => string;
method bashifyArg
bashifyArg: (arg: string) => string;
method combinedOutput
combinedOutput: () => Promise<string>;
method maskArg
maskArg: (arg: string) => string;
method output
output: () => Promise<string>;
method run
run: () => Promise<void> & { p: ChildProcess };
method spawn
spawn: () => ChildProcess;
class SubprocessError
class SubprocessError extends Error {}
Interfaces
interface SubprocessBashifyOptions
interface SubprocessBashifyOptions {}
property maskArgv0
maskArgv0?: boolean;
Mask file path to first argument.
The first argument to subprocesses is the program name or path, e.g.
/path/to/bin/my-program
. Iftrue
,bashify()
will return the program name without a file path, e.g.my-program
.The default is
true
.
property maskArgv1
maskArgv1?: boolean;
Mask file path to second argument.
In some subprocesses, the second argument is a script file to run, e.g.
node ./scripts/post-install
. Iftrue
,bashify()
will return the script name without a file path, e.g.node post-install
.The default is
false
.
property shiftArgv0
shiftArgv0?: boolean;
Remove the first argument from output.
Useful to make a command such as
node ./scripts/post-install
appear as simplypost-install
.The default is
false
.
interface SubprocessOptions
interface SubprocessOptions extends SpawnOptions {}
interface WhichOptions
interface WhichOptions {}
Package Files (1)
Dependencies (8)
Dev Dependencies (10)
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto your package's README, use the codes available below.
You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@ionic/utils-subprocess
.
- Markdown[](https://www.jsdocs.io/package/@ionic/utils-subprocess)
- HTML<a href="https://www.jsdocs.io/package/@ionic/utils-subprocess"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3006 ms. - Missing or incorrect documentation? Open an issue for this package.