Success stream not consistent with other streams #14464
Labels
Issue-Question
ideally support can be provided via other mechanisms, but sometimes folks do open an issue to get a
Resolution-Answered
The question is answered.
Steps to reproduce
Expected behavior
Actual behavior
Workaround
One workaround is to use success stream instead of information stream, ex
Write-Output
:Which results in output shown in
Expected behavior
, but problem is when we need to select property, ex:This is even worse because now we not only lost those informational messages, but the output doesn't look right either.
This is relatively simple example, since all of the output will still be on same screen, but often enough output can span 20 or more lines or consist of multiple unrelated outputs, and in that case how do you figure out which informational message is referring to which line or output?
You see a bunch on informational message in one place and a bunch of output in another place which looks like there is no connections between them and it kinds of defeats the purpose of non success streams. (at least when it comes to showing them in the console)
Expected behavior would be to print output sequentially instead of separating data and other streams into chunks.
Off course, same behavior happens with other streams:
Write-Warning
,Write-Error
,Write-Debug
etc.. but at least error stream will tell us on which line something happened, but that's not the case with other streams.I'm sure there must be some rationale behind current design, and if so, a switch parameter that would let us have expected behavior would be great, ex:
Additional related unexpected behavior
Please run both functions in same time as follows:
There is no way this should be expected behavior?
At least those 2 function outputs (including streams) should have been separated, because now it looks like there is one output while there are 2.
And if you go ahead and modify my second function
Test-Stream2
then it's going to be even worse because there will be no output at all:As you can see, the info messages are telling us both functions run, but second one didn't print anything, in fact it's not clear from this output which one failed and why.
If those informational messages would have been printed then we could tell at which point the output stopped working.
If after all these samples I'm still wrong, please let me know how to achieve what I'm trying to do.
EDIT:
Btw, I know we should use hash tables for key/value pairs, but this is just an example, and is reproducable with "non key/value pair" objects, create any
PSCustomObject
you like and the result will be the same.And
Format-Table
doesn't work for me, it only separates 2 functions, but streams are still unrelated to output.I should have titled this issue with
PSCustomObject
but I guess it's too late now...Environment data
The text was updated successfully, but these errors were encountered: