Skip to content
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

WriteColoredOutput vs Write-Error #175

Open
dcorriveau-omniscient opened this issue May 2, 2016 · 2 comments
Open

WriteColoredOutput vs Write-Error #175

dcorriveau-omniscient opened this issue May 2, 2016 · 2 comments

Comments

@dcorriveau-omniscient
Copy link

Hey ! I'm using CCNet as my buils server, and from what I can tell, they are listening on the error stream to determine errors (basically all it does is it sets the <message level="Error"> tag so that it can be parsed and colored appropriately on the dashboard. However, since psake is outputting catched errors using WriteColoredOutput (well, manually changing the color of the shell text), those error messages aren't displayed red in the dashboard.

Is there an option that I missed that would allow me to achieve what I want, or could I add the option myself to tell psake to use write-error instead ? Would you accept that pull request ? Thanks !

@mrhockeymonkey
Copy link

I agree with the above. In my mind since the function Invoke-PSake is using cmdletbinding() and therefore accepts -erroraction it should really be able to throw a real powershell error instead of output that is colored red. This has bred a bit of confusion at my place of work. I would be happy to submit such a pull request. Thoughts?

@UberDoodles
Copy link
Contributor

This could be resolved to some extent by issue #65, for which I have raised a pull request (#301).

The changes in that pull request mean that all of psake's messages are categorised (e.g. "error", "warning", "success", etc), and you can override how each of those messages are routed. For backwards-compatibility, the messages are handled in the same way as they always have (using WriteColoredOutput).

If we were to change the code to use Write-Error instead of WriteColoredOutput, this would be a breaking change that could cause people a lot of pain. So it might be better to leave WriteColoredOutput as the default, but be able to override it using the #65 solution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants