From 3005cc83e605fb89b079cf0e6fd0ec95cd27b30e Mon Sep 17 00:00:00 2001 From: Elizabeth Date: Wed, 28 May 2025 15:05:38 -0700 Subject: Run prettier, add zed settings --- u/process/run.ts | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-) (limited to 'u/process/run.ts') diff --git a/u/process/run.ts b/u/process/run.ts index 4954438..8004f75 100644 --- a/u/process/run.ts +++ b/u/process/run.ts @@ -17,11 +17,12 @@ export const getStdout = ( c: ITraceable, options: Deno.CommandOptions = {}, ): Promise> => - c.bimap(TraceUtil.withFunctionTrace(getStdout)) + c + .bimap(TraceUtil.withFunctionTrace(getStdout)) .map((tCmd) => { const cmd = tCmd.get(); tCmd.trace.trace(`:> im gonna run this command! ${cmd}`); - const [exec, ...args] = (typeof cmd === "string") ? cmd.split(" ") : cmd; + const [exec, ...args] = typeof cmd === "string" ? cmd.split(" ") : cmd; return new Deno.Command(exec, { args, stdout: "piped", @@ -30,35 +31,33 @@ export const getStdout = ( }).output(); }) .map((tOut) => - Either.fromFailableAsync(tOut.get()) + Either.fromFailableAsync(tOut.get()), ) .map( TraceUtil.promiseify((tEitherOut) => tEitherOut.get().flatMap(({ code, stderr, stdout }) => - Either - .fromFailable(() => { - const stdoutText = new TextDecoder().decode(stdout); - const stderrText = new TextDecoder().decode(stderr); - return { code, stdoutText, stderrText }; - }) + Either.fromFailable(() => { + const stdoutText = new TextDecoder().decode(stdout); + const stderrText = new TextDecoder().decode(stderr); + return { code, stdoutText, stderrText }; + }) .mapLeft((e) => { tEitherOut.trace.addTrace(LogLevel.ERROR).trace(`o.o wat ${e}`); return new Error(`${e}`); }) .flatMap((decodedOutput): Either => { const { code, stdoutText, stderrText } = decodedOutput; - tEitherOut.trace.addTrace(LogLevel.DEBUG).trace( - `stderr hehehe ${stderrText}`, - ); + tEitherOut.trace + .addTrace(LogLevel.DEBUG) + .trace(`stderr hehehe ${stderrText}`); if (code !== 0) { - const msg = - `i weceived an exit code of ${code} i wanna zewoooo :<`; + const msg = `i weceived an exit code of ${code} i wanna zewoooo :<`; tEitherOut.trace.addTrace(LogLevel.ERROR).trace(msg); return Either.left(new Error(msg)); } return Either.right(stdoutText); - }) - ) + }), + ), ), ) .get(); -- cgit v1.2.3-70-g09d2