You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 1, 2024. It is now read-only.
import{Effect,Stream,pipe,Equal}from"effect";import*asCommandfrom"@effect/platform/Command";import{layerasNodeCommandExecutor}from"@effect/platform-node/CommandExecutor";import{layerasNodeFs}from"@effect/platform-node/FileSystem";pipe(Command.make("ls","none-existing"),Command.start,Effect.tap((process)=>pipe(process.exitCode,Effect.filterOrFail(Equal.equals(0),()=>"Exit code not 0"),Effect.tapError(()=>// We'd like to print the stderr channel in case of non-zero exit code.pipe(process.stderr,Stream.merge(process.stdout),Stream.runCollect,Effect.tap(Effect.log))))),Effect.provideSomeLayer(NodeCommandExecutor),Effect.provideSomeLayer(NodeFs),Effect.runPromise);
The stderr and stdout streams are empty if we evaluate exitCode before running them.
If we do not evaluate exitCode and directly run the stream, it is not empty.
nandin-borjigin
changed the title
Cannot access process.exitCode and process.stdout, process.stderr at the same time.
Cannot access process.exitCode and process.stdout, process.stderr sequentially
Sep 14, 2023
stderr
andstdout
streams are empty if we evaluateexitCode
before running them.exitCode
and directly run the stream, it is not empty.The text was updated successfully, but these errors were encountered: