import { InternalBatchProcessOptions } from "./InternalBatchProcessOptions"; import { Parser } from "./Parser"; export type TaskOptions = Pick; /** * Whether a pending task has read its pass or fail token, so it settles once * its `streamFlushMillis` wait and parser finish. BatchProcess reads this; the * package doesn't export it. */ export declare function isSettling(task: Task): boolean; /** * Tasks embody individual jobs given to the underlying child processes. Each * instance has a promise that will be resolved or rejected based on the * result of the task. */ export declare class Task { #private; readonly command: string; readonly parser: Parser; readonly taskId: number; /** * @param {string} command is the value written to stdin to perform the given * task. * @param {Parser} parser is used to parse resulting data from the * underlying process to a typed object. */ constructor(command: string, parser: Parser); /** * @return the resolution or rejection of this task. */ get promise(): Promise; get pending(): boolean; get state(): string; /** * Called by BatchProcess when this task starts. Overrides must pass every * argument to `super.onStart()`, or {@link Task.resetTimeout} stops working. */ onStart(opts: TaskOptions, beforeParse?: () => void, resetTimeout?: () => boolean): void; /** * Restart this task's timeout. Call this only after verifying that the task * made progress: output alone is not progress. * * @return false if the task isn't running or has no timeout, and for * startup and health-check tasks. */ resetTimeout(): boolean; /** Time since this task started, or since its last timeout reset. */ get timeoutElapsedMs(): number | undefined; get runtimeMs(): number | undefined; toString(): string; onStdout(buf: string | Buffer): void; /** * Called with this task's stderr. Non-blank stderr is logged at warn, so a * subclass that removes lines it understands before calling * `super.onStderr()` keeps those lines out of the log. */ onStderr(buf: string | Buffer): void; /** * @return true if the wrapped promise was rejected */ reject(error: Error): boolean; }