@eagleoutice/flowr
Version:
Static Dataflow Analyzer and Program Slicer for the R Programming Language
26 lines (25 loc) • 2 kB
TypeScript
import type { Readable, Writable } from 'stream';
type Stdio = [stdin: Writable | null, stdout: Readable | null, stderr: Readable | null, extra: Writable | Readable | null | undefined, extra: Writable | Readable | null | undefined];
export type StdioProcessor = (stdio: Stdio) => void;
/**
* Simply captures the output of the script executed by {@link waitOnScript}.
* @param stdio - The standard io tuple provided by {@link waitOnScript}
* @param onStdOutLine - The callback is executed each time we receive a new line from the standard output channel.
* @param onStdErrLine - The callback is executed each time we receive a new line from the standard error channel.
*/
export declare function stdioCaptureProcessor(stdio: Stdio, onStdOutLine: (msg: string) => void, onStdErrLine: (msg: string) => void): void;
/**
* Run the given module with the presented arguments, and wait for it to exit.
* @param module - The (flowR) module that you want to use for the fork.
* It is probably best to use {@link __dirname} so you can specify the module relative to your
* current one.
* @param args - The arguments you want to start your process with.
* @param io - If you omit this argument, the in-, out- and error-channels of the script execution
* will be automatically forwarded to the respective in-, out- and error-channels of your process.
* However, by defining `io` you essentially gain full control on what should happen
* with these streams. For a simple capturing processor, for example if you want to collect
* the output of the script, see {@link stdioCaptureProcessor}.
* @param exitOnError - If set to `true`, the process will exit with the exit code of the script.
*/
export declare function waitOnScript(module: string, args: readonly string[], io?: StdioProcessor, exitOnError?: boolean): Promise<void>;
export {};