You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
If I pipe the output of a script (Get-FileHash for example), the strimg is truncated at the width of the window.
It should write the whole string into the file.
The behaviour is the same if the screen is the output. It should breake (feed) the line and continue to print the string to the next line.
The bug can be reproduced in any version and in any OS.
It isn't pipe text that is truncated, it is the formatting in Format-Table that is doing the truncating to align the columns.
I can see a few problems with this. With standard POSIX redirection you can determine the type of file descriptor that is used for stdout, whether it is a pipe, socket, tty or file. A program could then use COLUMNS or LINES when it identifies it as a tty. With PowerShell a given cmdlet or function has no idea what will be consuming the success pipeline.
I suspect that the Format-List/Format-Table family assume the output goes to a console. If you pipe an object that is not a string to the output then Out-String (or whatever is used) will need to choose to use one of the format cmdlets to convert the object to a suitable format for writing.
A second problem is that Format-Table constructs the table on the fly. It does not read all the input records then present the best format. It waits till either the end of the input or the first couple of records have been read. which ever comes first then sizes the columns based on what it has. All subsequent records then have the same column width.
Long ago someone decided that X > file should put the same thing in the file as appeared on the console.
The work round is to do x | out-string -width 1000 > file
It's in the "irritating things that have been that way for so long fixing them will create problems" pile.
Actually @rhubarb-geek-nz format-table and format-list don't set the widths. We can store their output ...
If I then split the panes the table objects are formatted differently
Prerequisites
Steps to reproduce
If I pipe the output of a script (Get-FileHash for example), the strimg is truncated at the width of the window.
It should write the whole string into the file.
The behaviour is the same if the screen is the output. It should breake (feed) the line and continue to print the string to the next line.
The bug can be reproduced in any version and in any OS.
Expected behavior
Actual behavior
Error details
Environment data
Visuals
If windowed:

If fullscreen:

The text was updated successfully, but these errors were encountered: