Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
ArcturusZhang committed Feb 18, 2025
1 parent 3dd76b5 commit 9d1b66a
Showing 1 changed file with 0 additions and 35 deletions.
35 changes: 0 additions & 35 deletions packages/http-client-csharp/emitter/src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -108,38 +108,3 @@ async function processJsonRpc(context: CSharpEmitterContext, message: string): P
return undefined;
}
}

export async function execAsync(
command: string,
args: string[] = [],
options: SpawnOptions = {},
): Promise<{ exitCode: number; stdio: string; stdout: string; stderr: string; proc: any }> {
const child = spawn(command, args, options);

return new Promise((resolve, reject) => {
child.on("error", (error) => {
reject(error);
});
const stdio: Buffer[] = [];
const stdout: Buffer[] = [];
const stderr: Buffer[] = [];
child.stdout?.on("data", (data) => {
stdout.push(data);
stdio.push(data);
});
child.stderr?.on("data", (data) => {
stderr.push(data);
stdio.push(data);
});

child.on("exit", (exitCode) => {
resolve({
exitCode: exitCode ?? -1,
stdio: Buffer.concat(stdio).toString(),
stdout: Buffer.concat(stdout).toString(),
stderr: Buffer.concat(stderr).toString(),
proc: child,
});
});
});
}

0 comments on commit 9d1b66a

Please sign in to comment.