@atomist/atomist-sdm
Version:
Atomist SDM to deliver our own projects
36 lines (35 loc) • 1.89 kB
TypeScript
import { GitCommandGitProject } from "@atomist/automation-client";
import { ExecuteGoalResult, ProgressLog, SpawnLogCommand } from "@atomist/sdm";
export declare function loglog(log: ProgressLog, msg: string): Promise<void>;
export declare type ExecuteLogger = (l: ProgressLog) => Promise<ExecuteGoalResult>;
export interface SpawnWatchCommand {
cmd: SpawnLogCommand;
cwd?: string;
}
/**
* Transform a SpawnWatchCommand into an ExecuteLogger suitable for
* execution by executeLoggers. The operation is awaited and any
* thrown exceptions are caught and transformed into an error result.
* If an error occurs, it is logged. The result of the operation is
* transformed into a ExecuteGoalResult. If an exception is caught,
* the returned code is guaranteed to be non-zero.
*/
export declare function spawnExecuteLogger(swc: SpawnWatchCommand): ExecuteLogger;
/**
* Transform a GitCommandGitProject operation into an ExecuteLogger
* suitable for execution by executeLoggers. The operation is awaited
* and any thrown exceptions are caught and transformed into an error
* result. The returned standard out and standard error are written
* to the log. If an error occurs, it is logged. The result of the
* operation is transformed into a ExecuteGoalResult. If an error is
* returned or exception caught, the returned code is guaranteed to be
* non-zero.
*/
export declare function gitExecuteLogger(gp: GitCommandGitProject, op: () => Promise<GitCommandGitProject>, name: string): ExecuteLogger;
/**
* Execute an array of logged commands, creating a line-delimited
* progress log beforehand, flushing after each command, and closing
* it at the end. If any command fails, bail out and return the
* failure result. Otherwise return Success.
*/
export declare function executeLoggers(els: ExecuteLogger[], progressLog: ProgressLog): Promise<ExecuteGoalResult>;