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

Running a powershell script changes the console to a raster font #2050

Closed
agocke opened this issue May 2, 2017 · 14 comments
Closed

Running a powershell script changes the console to a raster font #2050

agocke opened this issue May 2, 2017 · 14 comments
Labels

Comments

@agocke
Copy link
Member

agocke commented May 2, 2017

Create a simple powershell script, like the following:

echo.ps1
---------
echo "test"

and then run from within WSL, powershell.exe ./echo.ps1. The script runs successfully, but the font is changed to a raster font.

Microsoft Windows [Version 10.0.15063]

@agocke
Copy link
Member Author

agocke commented May 2, 2017

@sunjoong Sorry, typo. See edited (you have to use ./echo.ps1)

@sunjoong
Copy link

sunjoong commented May 2, 2017

@agocke - font not changed in my case

SUNJOONG-DESKTOP Desktop # /mnt/c/Windows/System32/WindowsPowerShell/v1.0/powershell.exe ./echo.ps1
test
SUNJOONG-DESKTOP Desktop #

@agocke
Copy link
Member Author

agocke commented May 2, 2017

Ah. It's particular to having opened the console through a shortcut pinned to the taskbar or start menu. Probably a write/permissions issue.

@sunjoong
Copy link

sunjoong commented May 2, 2017

@agocke - Hmm... that could be. I'm using through bash shortcut in start menu and admin account in windows side and root in linux.

@agocke
Copy link
Member Author

agocke commented May 2, 2017

@sunjoong Try it from the taskbar.

@sunjoong
Copy link

sunjoong commented May 2, 2017

@agocke - same as shortcut in start menu.

@agocke
Copy link
Member Author

agocke commented May 2, 2017

@sunjoong 🤷‍♂️ Sounds like it's on the WSL team to sort out 😄

@sunjoong
Copy link

sunjoong commented May 2, 2017

@agocke - Haha, no. If so am I, I should test with standard user account and normal linux account too. But, I'm doing something with this admin and root now.

@ghost
Copy link

ghost commented May 6, 2018

This affects me as well.

@jay-tuckey
Copy link

This seems to be specifically when you try to pipe the output of the powershell command. For me:
~> powershell.exe -command 'write-host hi' - This doesn't change the font
~> powershell.exe -command 'write-host hi' | echo - This will change the font to a raster font. It also throws an error:

~> powershell.exe -command 'write-host hi' | echo

write-host : The specified network name is no longer available.
At line:1 char:1
+ write-host hi
+ ~~~~~~~~~~~~~
    + CategoryInfo          : NotSpecified: (:) [Write-Host], IOException
    + FullyQualifiedErrorId : System.IO.IOException,Microsoft.PowerShell.Commands.WriteHostCommand

@therealkenc
Copy link
Collaborator

therealkenc commented Feb 4, 2019

Wasn't able to reproduce the 'raster font' behavior, which is kind of where this one has sat since May 2017. Maybe post a screencap just so there is clarity on what you are seeing. Also might be worth trying against wsltty or ttyd (or whatev) just to get a baseline versus the Windows Console.

As for the error, /bin/echo (or equivalent shell builtin) doesn't read from standard input so I can see how that might not work. Erroring out like that seems suboptimal though. Probably the input should be eaten silently, but oddly enough I've never even thought too hard about what consumes the characters if you do say a /bin/echo hello | /bin/echo goodbye in Linux. If you feel strongly about it spawn a new issue since this one is about the raster problem (such that it is). [ed] Piping cat (which is sensible) works as expected.

@jay-tuckey
Copy link

jay-tuckey commented Feb 5, 2019

Whoops, sorry @therealkenc , my mistake using echo instead of cat.

Here's some better detail:
Windows Build

PS C:\> Get-ComputerInfo -Property WindowsBuildLabEx

WindowsBuildLabEx
-----------------
17763.1.amd64fre.rs5_release.180914-1434

Steps to reproduce error

  • Run ubuntu shell from start menu
  • Settings before:
    image
  • Execute powershell.exe -command 'Write-output hi' - no change to fonts etc.
jtuckey@jay-x1-carbon:~$ powershell.exe -command 'Write-output hi'
hi
  • Execute powershell.exe -command 'Write-output hi' | cat - no error (now that I'm using cat 🙃), but fonts change to raster and console resizes. Settings after:
    image

I'll give it a try now in mintty, and see if it works. [edit] Have tried in mintty and no issue there.

@therealkenc
Copy link
Collaborator

therealkenc commented Feb 5, 2019

Okay got it. The variable between me (and others for two years) and you is that you started off on "Consolas". I started with "Lucida Console". I was able to reproduce starting with Consolas (whee). I'm on 18329, but the version isn't going to matter. Clearly the behavior has existed since the beginning of time.

Whatever is causing the font setting change, this is squarely Windows Console territory. Re-file over there and cite this issue. It is possible there is some cross-border problem and interop is pushing some weird data we can't see. But it works okay with wsltty (Consolas or otherwise), and WSL proper doesn't have any direct (or at least intended) way to cause the font to reset like that. Even if interop was subtly broken the terminal ought not do that. Bonne chance, and thank you for the persistence. This would have sat another two years without your repro.

@jay-tuckey
Copy link

Logged as microsoft/terminal#367 for anyone who ends up here from a DuckDuckGo search. 🙂

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

No branches or pull requests

4 participants