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

fix(cli-repl): support bracketed paste on Windows MONGOSH-1999 #2338

Merged
merged 2 commits into from
Jan 31, 2025
Merged

Conversation

addaleax
Copy link
Contributor

Split out into a separate piece because this adds a patch to libuv that has non-trivial downsides, as explained in the referenced PR. I'd assume that mitigating this through a process.on('exit') handler is sufficient and that we don't need to plan specifically for e.g. hard crashes of mongosh here, but I didn't want to merge this together with the original work in 4232a98 but rather have it stand on its own (including for the simple reason that it's easier to revert if we decide that we have to).

Refs: libuv/libuv#4688

Split out into a separate piece because this adds a patch to libuv
that has non-trivial downsides, as explained in the referenced PR.
I'd assume that mitigating this through a `process.on('exit')` handler
is sufficient and that we don't need to plan specifically for e.g.
hard crashes of mongosh here, but I didn't want to merge this together
with the original work in 4232a98 but rather have it stand
on its own (including for the simple reason that it's easier to revert
if we decide that we have to).
#define ENABLE_VIRTUAL_TERMINAL_PROCESSING 0x0004
#endif
+#ifndef ENABLE_VIRTUAL_TERMINAL_INPUT
+#define ENABLE_VIRTUAL_TERMINAL_INPUT 0x0200
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the significance of the 0x0200 value? is it just an available value?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can look up the values here: https://learn.microsoft.com/en-us/windows/console/setconsolemode#parameters

This #define, like the one above, is added in case the compilation happens on a Windows machine that doesn't have the most recent system headers and doesn't know about the flag yet, so you can still compile a program that can make use of it when run on more recent Windows machines.

That's not a practical concern for mongosh, but for the libuv PR it's relevant.

Copy link
Contributor

@gagik gagik left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very unfamiliar territory for me but seems to make sense.

@addaleax
Copy link
Contributor Author

Alright, I'll go ahead with this, even though we know it's quite likely that we'll need to adjust the libuv patch here a bit more.

@addaleax addaleax merged commit bd0ca20 into main Jan 31, 2025
135 checks passed
@addaleax addaleax deleted the 1999-dev branch January 31, 2025 11:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants