-
Couldn't load subscription status.
- Fork 1.4k
Add Console support for printing to standard error #3925
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 Console support for printing to standard error #3925
Conversation
45e8fd4 to
3e8da65
Compare
|
@BardurArantsson Sorry for the delay, will review this weekend. |
|
No worries at all! I was just a bit confused about what the exact process was :) |
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.
Looks great! Just a couple of minor comments on naming and documentation.
| * Returns the contents of the output buffer. The first value written to | ||
| * the output buffer will be the first in the sequence. | ||
| */ | ||
| val errOutput: UIO[Vector[String]] = |
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.
Maybe outputErr for IDE discoverability? Also update Scaladoc.
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.
Sure.
I wasn't quite sure what if you'd like to have the member in the Data class changed too, so I've left it for now. (It seems reasonable to me since it isn't really an issue for IDE discoverability and it is a "thing"... "the error output".)
Let me know if you'd like me to change that too -- I have no strong opinion on it :).
3e8da65 to
64b3d4c
Compare
|
New version uploaded. Hopefully it'll get through CI without issue :) |
| * Accesses a `TestConsole` instance in the environment and returns the | ||
| * contents of the error buffer. | ||
| */ | ||
| val errOutput: ZIO[TestConsole, Nothing, Vector[String]] = |
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.
Update name to conform to change above.
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.
Sorry about missing that. Can you tell I'm a bit of a noob with this pattern? ;)
I've rebased on latest master and pushed a new version.
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.
No worries! You're contributing so you're already one step ahead! 😃
64b3d4c to
ca5c7ea
Compare
|
Hm, seems to be a test failure, but I'm pure sure it's unrelated to anything I did. Not sure what the procedure here is... (I see there's a Rerun button in the CircleCI user interface, but it's grayed out for me.) |
|
I reran that test. |
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.
Looks great! Congratulations on your first contribution to ZIO!
|
Cool, thanks! :) |
Since I had a need for printing to the standard error in a little console application, I thought I'd try adding support upstream :). I might be missing something, but it seems like a small little win to add it.
I'm not exactly in love with the naming here, but OTOH I couldn't come up with anything much better. I considered using simply 'E' as the suffix, but that might be a little bit too opaque. Prefixing seems a bit odd because you then get different cases for the 'p' in errPutStrLn and putStrLn which might be annoying.
EDIT: I also tried to see if there was precedent in Haskell, but they only have putStr/putStrLn and hPutStr/hPutStrLn (which is the generalized handle version which already exists in the "live" scala implementation, but isn't exposed -- presumably because of a lack of safety for arbitrary PrintStreams).