Closed lamw closed 1 year ago
The problem comes from the TERM
environment variable which is set to linux
in the base container. The default width in columns of the TERM
linux
is small to display the formatted hashtable.
Suggested workarounds of the issue
Out-String
cmdlet
docker run --rm lamw/ps -Command '$hash=@{"foo"="bar"};$hash | out-string -Width 80'
TERM
in your image
FROM vmware/powerclicore
ENV TERM xterm
ENTRYPOINT ["/bin/pwsh"]
Meanwhile, I'll update the powerclicore
image to use linux-basic
terminal which hasn't this issue
Pushed new version of vmware/powerclicore
image with the fix. The tags latest
and 12.3.1
have the fix now.
Tested:
Dockerfile
FROM vmware/powerclicore
ENTRYPOINT ["/bin/pwsh"]
docker build -t dmpcli .
docker run --rm dmpcli -Command "`$hash=@{'foo'='bar'};`$hash|out-string"
Name Value
---- -----
foo bar
The fix of this one led to regression in the interactive scenario which is more important than this one. Reverting the fix here with the ask to run it with -e TERM=linux-basic
as a workaround
It looks like PowerShell Hashtables can not be printed using current Photon/PowerShell Docker Container. Using the Microsoft image, it does work and assume this is related to either the version of PS (latest for Photon is
7.1.2
) and Microsoft version is7.1.3
and I've not had success in manually installing the latest version using Photon Docker container to confirm if its related to PowerShell version and/or underlying container OSCurrent Behavior:
Dockerfile:
No output when attempting to pass
$hash
to Out-String cmdlet:Expected Behavior: