diff options
Diffstat (limited to 'u/process/run.ts')
-rw-r--r-- | u/process/run.ts | 18 |
1 files changed, 11 insertions, 7 deletions
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 = <Trace>( stdout: "piped", stderr: "piped", ...options, - }).output(); + }); }) - .map((tOut) => - Either.fromFailableAsync<Error, Deno.CommandOutput>(tOut.get()), + .map((tCmd) => + Either.fromFailableAsync<Error, Deno.CommandOutput>(() => + tCmd.get().output(), + ), ) .map( TraceUtil.promiseify((tEitherOut) => @@ -45,11 +47,13 @@ export const getStdout = <Trace>( tEitherOut.trace.addTrace(LogLevel.ERROR).trace(`o.o wat ${e}`); return new Error(`${e}`); }) - .flatMap((decodedOutput): Either<Error, string> => { + .flatMap((decodedOutput): IEither<Error, string> => { 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); |