4 ms·
This is definitely one of the things that PowerShell got right. 6 different streams, each of which can be intercepted separately and configured differently. ht
by AndrewDucker 2y ago
This is definitely one of the things that PowerShell got right. 6 different streams, each of which can be intercepted separately and configured differently.
https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_output_streams?view=powershell-7.4 https://learn.microsoft.com/en-us/powershell/module/microsof...
- matheusmoreira 2y agoThere's a lot of good ideas in power shell. I like how they broke up the log stream into separate streams by severity. It still seems arbitrary and insufficiently general though. Why severity and not some other criteria? What if programs could define any number of output streams? By default they could all coalesce into the terminal but other programs could connect to each one separately if they needed. Like an audio mixer of sorts: by default you get the mixed audio but there are ways to access each individual voice if needed.
- immibis 2y agoI don't think that 6 different streams that will always go to the same place but some of them are usually turned off are very useful. Standard-error/user is useful because it goes to a different place. Levels would be better suited to a simple global variable, or a level associated with each printed line. The chance that someone redirects errors to error.log is reasonable, but the chance that someone redirects errors to error.log and warnings to warning.log and debug to debug.log and verbose to verbose.log is pretty low.
- AndrewDucker 2y agoI turn on Verbose logging sometimes, to get more info. Error logging can be set to either spit out the error and continue, or to stop processing, which is very useful. Warning and error messages come out in their own colours automatically, which is nice. And sure, you can just have them all come out to the same place. But having the options to configure them is very handy.
- immibis 2y agoNone of this is related to them being separate streams instead of metadata in one stream
- MatejKafka 2y agoAlso related to the article, PowerShell has PSReadLine, which implements a pretty reasonable text editor, including selection, copy/paste, classic keybindings such as Home/End/Ctrl-arrows, sane multiline command editing, semantic autocomplete and custom actions that can operate on input AST. Once you get used to having all that, going back to other shells is pretty hard.