Skip to content

Commit

Permalink
Implement ExecStack.read
Browse files Browse the repository at this point in the history
  • Loading branch information
pbrisbin committed Feb 10, 2024
1 parent fe13b3a commit d5e820f
Showing 1 changed file with 15 additions and 4 deletions.
19 changes: 15 additions & 4 deletions src/exec-stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,23 @@ export class ExecStack {
.concat(args);
}

async exec(args: string[]): Promise<number> {
return await exec.exec("stack", this.stackArguments.concat(args));
async exec(args: string[], options?: exec.ExecOptions): Promise<number> {
return await exec.exec("stack", this.stackArguments.concat(args), options);
}

async read(_args: string[]): Promise<string> {
return "TODO";
async read(args: string[]): Promise<string> {
let stdout = "";

const options: exec.ExecOptions = {
listeners: {
stdout: (data: Buffer) => {
stdout += data.toString();
},
},
};

await this.exec(args, options);
return stdout;
}

async parse<A>(args: string[], f: (stdout: string) => A): Promise<A> {
Expand Down

0 comments on commit d5e820f

Please sign in to comment.