///
import { ExecOptions } from "child_process";
export interface CommandResult {
stdout: string;
stderr?: string;
}
/**
* Test part of a command verification request.
* Allows reuse of command testing without defining
* actions on success or failure, which are more likely to vary
* in different contexts.
*/
export interface CommandTest {
/**
* Command, including arguments, to pass to exec
*/
command: string;
/**
* Test for the output of a successful command
* @param {string} stdout
* @return {boolean}
*/
outputTest?: (output: CommandResult) => boolean;
/**
* Options to pass to child_process.exec
*/
execOptions?: ExecOptions;
}
export interface CommandVerificationRequest extends CommandTest {
/**
* Called when the command failed: For example,
* because the command isn't installed
* @param {Error} e
*/
onFailure: (e: Error) => void;
/**
* Called when the command returns normally but we don't
* like the returned result (test failed)
*/
onWrongVersion: (r: CommandResult) => void;
/**
* Called when the command is successfully verified
* @param {string} stdout
*/
onVerified?: (stdout: string) => void;
}
/**
* Verify the result of a command. Useful to test
* whether a dependency of an SDM is installed
* @param {CommandVerificationRequest} opts
* @return {Promise}
*/
export declare function verifyCommandResult(opts: CommandVerificationRequest): Promise;