-
Couldn't load subscription status.
- Fork 1.4k
Add App ExitCode #3583
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add App ExitCode #3583
Conversation
6fd3605 to
84e908a
Compare
|
/cc @adamgfraser for the scalafix part |
c5106da to
f9a1f8a
Compare
| * Maps this effect to the default exit codes. | ||
| */ | ||
| final def exitCode: URIO[R, ExitCode] = | ||
| self.foldCauseM(cause => UIO(println(cause.prettyPrint)) as ExitCode.failure, _ => ZIO.succeedNow(ExitCode.success)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let’s use putStrLn instead of println here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iravid I took this combinator from #2153, I suspect John suggested println to avoid adding a dependency on Console at the end of your program. OTOH, App uses ZEnv anyway so even if you write program.provideSomeLayer(ZEnv.live ++ customLayers).exitCode it won't crash as Console would be its only missing dependency which the default runtime will provide.
I will update in a few minutes (cc: @jdegoes)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@iravid done
|
@luis3m Thank you for this wonderful contribution! Much better than |
Addresses #2153 (cc @adamgfraser @jdegoes)