diff --git a/src/exec-stack.ts b/src/exec-stack.ts index 8d3d701..806da02 100644 --- a/src/exec-stack.ts +++ b/src/exec-stack.ts @@ -14,12 +14,23 @@ export class ExecStack { .concat(args); } - async exec(args: string[]): Promise { - return await exec.exec("stack", this.stackArguments.concat(args)); + async exec(args: string[], options?: exec.ExecOptions): Promise { + return await exec.exec("stack", this.stackArguments.concat(args), options); } - async read(_args: string[]): Promise { - return "TODO"; + async read(args: string[]): Promise { + let stdout = ""; + + const options: exec.ExecOptions = { + listeners: { + stdout: (data: Buffer) => { + stdout += data.toString(); + }, + }, + }; + + await this.exec(args, options); + return stdout; } async parse(args: string[], f: (stdout: string) => A): Promise {