UNPKG

@specs-feup/lara

Version:

A js port of the popular framework for building source-to-source compilers

63 lines 2.23 kB
import { JavaClasses } from "./JavaTypes.js"; import TimeUnits, { TimerUnit } from "./TimeUnits.js"; /** * Launches processes. */ export default class ProcessExecutor { workingDir: string; printToConsole: boolean; outputFile: string | undefined; append: boolean; timeUnit: TimeUnits; timeout: number | undefined; outputPrefix: string | undefined; stopOnError: boolean; logErrorsOnly: boolean; private lastOutput; private lastCommand; private _customReturnValue; setWorkingDir(workingDir: string): this; getWorkingDir(): string; /** * Sets if the output of the process should be output to the console. * */ setPrintToConsole(printToConsole?: boolean): this; setOutputFile(outputFile: string): this; /** * Sets if the output should be appended to the output of the previous execution. * */ setAppend(append?: boolean): this; /** * If true, throws an exception if there is a problem when running the process. By default is set to 'false'. */ setStopOnError(stopOnError?: boolean): this; setLogErrorsOnly(logErrorsOnly?: boolean): this; /** * Sets the time unit of the timeout value. By defaults, is SECONDS. */ setTimeUnit(timeUnit: TimerUnit): this; setTimeout(timeout: number): this; /** * @param returnValue - An integer that represents the return value of the process executor */ setCustomReturnValue(returnValue: string): this; setCustomReturnValue(returnValue: number): this; setOutputPrefix(outputPrefix: string): this; /** * * @param command - The command to be executed. Accepts a command as a sequence of strings, or as an array with strings. */ execute(...command: string[]): string | undefined; getCommand(): string[] | undefined; /** * @returns The file of the executable of the command, or undefined if could not locate the file. */ getExecutableFile(): JavaClasses.File | undefined; getConsoleOutput(): string | undefined; getReturnValue(): number | undefined; getStdOut(): string | undefined; getStdErr(): string | undefined; } //# sourceMappingURL=ProcessExecutor.d.ts.map