From 2ae2ebc8aa7c4600f499ab7d2264dcb1d16db4ae Mon Sep 17 00:00:00 2001 From: Elizabeth Date: Mon, 2 Jun 2025 19:27:15 -0700 Subject: Fixes when getStdout would throw early --- u/process/run.ts | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) (limited to 'u/process/run.ts') diff --git a/u/process/run.ts b/u/process/run.ts index 8004f75..7a74c3e 100644 --- a/u/process/run.ts +++ b/u/process/run.ts @@ -28,10 +28,12 @@ export const getStdout = ( stdout: "piped", stderr: "piped", ...options, - }).output(); + }); }) - .map((tOut) => - Either.fromFailableAsync(tOut.get()), + .map((tCmd) => + Either.fromFailableAsync(() => + tCmd.get().output(), + ), ) .map( TraceUtil.promiseify((tEitherOut) => @@ -45,11 +47,13 @@ export const getStdout = ( tEitherOut.trace.addTrace(LogLevel.ERROR).trace(`o.o wat ${e}`); return new Error(`${e}`); }) - .flatMap((decodedOutput): Either => { + .flatMap((decodedOutput): IEither => { const { code, stdoutText, stderrText } = decodedOutput; - tEitherOut.trace - .addTrace(LogLevel.DEBUG) - .trace(`stderr hehehe ${stderrText}`); + if (stderrText) { + tEitherOut.trace + .addTrace(LogLevel.DEBUG) + .trace(`stderr: ${stderrText}`); + } if (code !== 0) { const msg = `i weceived an exit code of ${code} i wanna zewoooo :<`; tEitherOut.trace.addTrace(LogLevel.ERROR).trace(msg); -- cgit v1.2.3-70-g09d2