ChildProcess (interface)
A class which represents a child process. The process may or may not be running.
This class is the API used internally by the exec function to spawn child processes.
Generally, you should not need to use the ChildProcess class directly, and
should use exec or $ instead. However, you may need to use it in some
special cases, like when specifying custom stdio for a process, or spawning a
non-blocking long-running process.
[key: string]: string;
};
stdio: {
};
| {
status: number;
signal: undefined;
}
| {
status: undefined;
signal: number;
};
}
ChildProcess.args (property)
The argv for the process. The first entry in this array is the program to run.
ChildProcess.cwd (Path property)
The current working directory for the process.
ChildProcess.env (object property)
The environment variables for the process.
[key: string]: string;
};
ChildProcess.stdio (object property)
The standard I/O streams for the process. Generally these are the same as
std.in, std.out, and std.err, but they can be customized to write
output elsewhere.
ChildProcess.stdio.in (FILE property)
Where the process reads stdin from
ChildProcess.stdio.out (FILE property)
Where the process writes stdout to
ChildProcess.stdio.err (FILE property)
Where the process writes stderr to
ChildProcess.state (getter)
ChildProcess.pid (getter)
ChildProcess.start (method)
Spawns the process and returns its pid (process id).
ChildProcess.waitUntilComplete (method)
Blocks the calling thread until the process exits or is killed.
status: number;
signal: undefined;
} | {
status: undefined;
signal: number;
};
ChildProcessState (type)
| {
id: "UNSTARTED";
}
| {
id: "STARTED";
}
| {
id: "STOPPED";
}
| {
id: "CONTINUED";
}
| {
id: "EXITED";
oldPid: number;
status: number;
}
| {
id: "SIGNALED";
oldPid: number;
signal: number;
};
ChildProcessOptions (type)
Options to be passed to the ChildProcess constructor. Their purposes and types match the same-named properties found on the resulting ChildProcess.
ChildProcessOptions.cwd (property)
The current working directory for the process.
ChildProcessOptions.env (object property)
The environment variables for the process.
[key: string]: string;
};
ChildProcessOptions.stdio (object property)
The standard I/O streams for the process. Generally these are the same as
std.in, std.out, and std.err, but they can be customized to write
output elsewhere.
ChildProcessOptions.stdio.in (FILE property)
Where the process reads stdin from
ChildProcessOptions.stdio.out (FILE property)
Where the process writes stdout to
ChildProcessOptions.stdio.err (FILE property)
Where the process writes stderr to
ChildProcessOptions.logging (object property)
Options which control logging
ChildProcessOptions.logging.trace (function property)
Optional trace function which, if present, will be called at various times to provide information about the lifecycle of the process.
Defaults to the current value of logger.trace. logger.trace
defaults to a function which writes to stderr.
ChildProcessConstructor (interface)
new (
}
ChildProcessConstructor new(...) (construct signature)
Construct a new ChildProcess.
@paramargs — The argv for the process. The first entry in this array is the program to run.@paramoptions — Options for the process (cwd, env, stdio, etc)
new (args: string | Path | Array<string | number | Path>, options?: ChildProcessOptions): ChildProcess;
ChildProcessConstructor.prototype (readonly ChildProcess property)