bugy / script-server

Web UI for your scripts with execution management
Other
1.61k stars 250 forks source link

Powershell Core #263

Open juliostanley opened 4 years ago

juliostanley commented 4 years ago

Thank for making script server. Its great.

Just wondering, have you tried using it with pwsh (powershell core) on linux. I used the docker container to run a quick test, but there seems to be an issue with the encoding, and also it wasn't able to read input. Any thoughts?

I used these steps for installing powershell core on the debian 10 container https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-7#debian-10

image

bugy commented 4 years ago

Hi Julio,

Unfortunately I didn't try powershell.

At your output it looks like there is an ANSI escape sequence in the beginning. Script server supporst most common sequences, but not that one on the screen shot

Julio Stanley notifications@github.com schrieb am Do., 6. Feb. 2020, 01:45:

Thank for making script server. Its great.

Just wondering, have you tried using it with pwsh (powershell core) on linux. I used the docker container to run a quick test, but there seems to be an issue with the encoding, and also it wasn't able to read input. Any thoughts?

I used these steps for installing powershell core on the debian 10 container

https://docs.microsoft.com/en-us/powershell/scripting/install/installing-powershell-core-on-linux?view=powershell-7#debian-10

[image: image] https://user-images.githubusercontent.com/535708/73896055-a7059a80-484f-11ea-9f48-3c45f2ed0010.png

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/bugy/script-server/issues/263?email_source=notifications&email_token=AAJXPJPKEXDDKV4HZFQY2PLRBNMS7A5CNFSM4KQURBHKYY3PNVWWK3TUL52HS4DFUVEXG43VMWVGG33NNVSW45C7NFSM4ILLZXCQ, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJXPJKCOIL5GLY4AXVZAFLRBNMS7ANCNFSM4KQURBHA .

juliostanley commented 4 years ago

Yeah, haven't looked into the code much, but I just noticed that setting requires_terminal to false will work. Something regarding the encoding and the pty wrapper is causing it to have an issue on input, and that escape sequence output.

When using pty wrapper not sure why input would be broken, It just seems to hang and even throw new non properly encoded characters.

image

bugy commented 4 years ago

Hi @juliostanley thanks for the info! It seems that powershell behaves differently in PTY mode. It tries to be more fancy and sends colored output, formatting, etc. When you disable PTY, powershell just prints plain text

Could you try running your script from console and forward output to some file? I would expect it to contain special characters (like the one [?1h on the screenshot)

bugy commented 4 years ago

Hi @juliostanley did you try running it from the console? This information would be quite helpful

bugy commented 4 years ago

Alright, I managed to reproduce it. To be honest, I don't know how powershell works internally, and why it ignores user input in PTY mode. I used Console.readline function and it worked for me However for me foreground color was ignored in script server (it was just black), even though the Read-Host error was properly colored.

This extra [?1h character is not supported

I won't put much effort into this ticket, since "requires_terminal" works nice and Read-Host can be replaced with ReadLine