/// /// /// import { SpawnOptions } from "child_process"; import { IManifest } from "cdktn"; /** * Spawn a child process and mirror its stdout to the parent's console. * * Thin wrapper over {@link exec} for callers that want stdout chunks echoed via `console.log` as they arrive. Stderr is * captured silently and surfaced on the thrown Error's `.stderr` / `toString()` if the process exits non-zero. * * @param program the executable to spawn * @param args arguments passed to the executable * @param options spawn options; `noColor: true` strips ANSI escapes from captured output * @returns the full concatenated stdout as a string on success * @throws an Error with `.stderr` and `.stdout` properties (see {@link attachProcessOutput}) on non-zero exit */ export declare function shell(program: string, args?: string[], options?: SpawnOptions & { noColor?: boolean; }): Promise; export declare function withTempDir(dirname: string, closure: () => Promise): Promise; export declare function mkdtemp(closure: (dir: string) => Promise): Promise; /** * Spawn a child process and resolve with its stdout, or reject with a decorated Error on non-zero exit. * * Captured stdout and stderr are always tee'd to `processLoggerDebug` / `processLoggerError`. The optional `stdout` and * `stderr` callbacks receive each sanitized chunk as it arrives — useful for streaming output to the terminal. * Passing a `stderr` callback (even a no-op) suppresses the default pass-through to `process.stderr` for that stream. * * On non-zero exit, rejects with an {@link ExecError} carrying `.stderr` / `.stdout` and a `toString()` that includes * the captured body (see {@link attachProcessOutput}); `.message` itself stays as the headline. * * @param command the executable to spawn * @param args arguments passed to the executable * @param options spawn options; `noColor: true` strips ANSI escapes from captured output (auto-detected from CLI flags * / `FORCE_COLOR=0` when omitted) * @param stdout optional per-chunk callback for sanitized stdout * @param stderr optional per-chunk callback for sanitized stderr; passing a callback suppresses default terminal echo * @param sendToStderr when false, suppresses both the stderr callback invocation and the default terminal echo * @returns the full concatenated stdout as a string on success */ export declare const exec: (command: string, args: string[], options: SpawnOptions & { noColor?: boolean; }, stdout?: (chunk: string) => any, stderr?: (chunk: string | Uint8Array) => any, sendToStderr?: boolean) => Promise; export declare function readCDKTFVersion(outputDir: string): Promise; export declare function readCDKTFManifest(): Promise; /** * Downcase the first character in a string. * * @param str the string to be processed. */ export declare function downcaseFirst(str: string): string; export declare class HttpError extends Error { statusCode?: number | undefined; constructor(message?: string, statusCode?: number | undefined); } export declare function downloadFile(url: string, targetFilename: string): Promise; /** * Awaits a promise and makes sure it's error (if any) is only thrown after all other promises are settled * if the promise does not throw an error, the other promises won't be awaited * @param p promise to await * @param promises promises to await to be all settled if p failed before throwing error that p failed with */ export declare function ensureAllSettledBeforeThrowing(p: Promise, promises: (Promise | undefined)[]): Promise; /** * returns true if --no-color is passed as CLI flag or the env var FORCE_COLOR is set to "0" * Used for cases where we can't pass down the noColor flag (e.g. when collecting debug information from the environment) * This is the same behavior as the `chalk` lib we use for coloring output */ export declare function hasNoColorFlagOrEnv(): boolean; //# sourceMappingURL=util.d.ts.map