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

Filter out ConEmuANSI and ConEmuHooks environment variables #106

Open
rprichard opened this issue Mar 23, 2017 · 2 comments
Open

Filter out ConEmuANSI and ConEmuHooks environment variables #106

rprichard opened this issue Mar 23, 2017 · 2 comments

Comments

@rprichard
Copy link
Owner

Work around Maximus5/ConEmu#1068 by filtering out the ConEmuANSI and ConEmuHooks environment variables.

winpty.exe already filters out TERM, but it does so in the Cygwin/MSYS adapter. Filtering the ConEmu flags probably needs to happen in winpty.dll so it applies automatically to all programs using winpty.

I had preferred to keep environment filtering restricted to winpty.exe, because it keeps the winpty.dll API simpler. There is a winpty_spawn_config_new function that accepts an environment block, which is passed as-is to the child process. The history of winpty clients, though, is that even if TERM isn't set (and why would it be on Windows?), programmers embedding winpty frequently go out of their way to set TERM to xterm.

The appropriate default, therefore, is to clear TERM as well, in winpty.dll.

The big question is whether there should be some way to disable or restrict the filtering. I don't think anyone needs it, so maybe it could be omitted. (One random thought I had: if I add a winpty_spawn_config_set_env(name, val) API that overrides filtering, then some embedder will probably use it not to avoid filtering, but because they don't like setting up an envblock in memory.)

I might leave the winpty.exe TERM filtering in place for now, just in case someone upgrades winpty.exe without upgrading winpty.dll.

@rprichard rprichard changed the title Filter out ConEmuANSI and ConEmuHooks environment variable Filter out ConEmuANSI and ConEmuHooks environment variables Mar 23, 2017
@rprichard
Copy link
Owner Author

Maybe add a WINPTY_SPAWN_FLAG_UNFILTERED_ENVBLOCK spawn flag. By default, the agent will never pass a nullptr envblock to CreateProcess anymore.

@rprichard
Copy link
Owner Author

It might be a good idea to check out ConsoleZ, too (ConsoleZVersion environment variable): https://github.com/docker/docker/blob/278b36e5ce2f3be6d2db9a9b39b1e7357aaeab7b/pkg/term/term_windows.go#L74

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

No branches or pull requests

1 participant