The best way to control Claude Code, Codex and more from any computer or phone

main
ts 16 lines 538 Bytes
Raw
1 import * as Effect from "effect/Effect";
2 import type { ChildProcess } from "effect/process";
3 import * as Stream from "effect/Stream";
4
5 export const exec = Effect.fn("exec")(function* (command: ChildProcess.Command) {
6 const handle = yield* command;
7 const [exitCode, stdout, stderr] = yield* Effect.all(
8 [
9 handle.exitCode,
10 handle.stdout.pipe(Stream.decodeText, Stream.mkString),
11 handle.stderr.pipe(Stream.decodeText, Stream.mkString),
12 ],
13 { concurrency: 3 },
14 );
15 return { exitCode, stdout, stderr };
16 });