How to trick Powershell into thinking it's not redirected #3914
HerrNamenlos123
started this conversation in
General
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi!
Sorry if this is the wrong place to ask, but it's at least a starting point for me.
I want to create my own Terminal emulator, and a few tests showed that it is relatively simple to just call cmd or powershell in a subprocess, and redirect stdout and stdin. Then I can simply render stdout in a text buffer.
I am using reproc/reproc++ to call powershell in a subprocess and redirect the pipes. I would build the emulator in Windows-subsystem and a rendering canvas that renders the content of stdout. I will implement VT parsing using a third party library I have not chosen yet.
Now, the issue is that when I call powershell (and I have
Set-PSReadLineOption -PredictionSource History
enabled), then I get a huge warning:So now my question is what do I have to do so that powershell operates normally and does not care it's redirected? I am afraid that even if I find a workaround for powershell, other programs might also break down the road, so how can I fix the root cause?
If there is a better way to emulate a terminal and my entire approach is flawed, I am also open for suggestions... Thanks!
Beta Was this translation helpful? Give feedback.
All reactions