-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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: stdout and stderr encoding on Windows #14559
Conversation
I tried to add a test for this, but whatever I tried passed before and after (I think probably because our test utilitity collects data with a pipe and so it's not a console and doesn't get this special behaviour applied) Edit: Nevermind. Added a pty test. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM - lack of test is unfortunate but I don't have any suggestions...
/// that is then cloned when obtaining stdio for process. In turn when | ||
/// resource table is dropped storing reference to that handle, the handle | ||
/// itself won't be closed (so Deno.core.print) will still work. | ||
// TODO(ry) It should be possible to close stdout. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
regarding the TODO is it possible to close stdout after this patch?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, not possible still. I removed the todo because I didn't think it was worth keeping it in the code since I think doing this will arise from the need to do it.
Actually, Bartek had the good idea of testing this in a pty and I just thought to repurpose the repl tests for this. I just tried it out and it fails on main, but passes on this branch. The downside of course is that it doesn't run on the CI, but better than nothing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
// windows was having issues displaying this | ||
util::with_pty(&["repl"], |mut console| { | ||
console.write_line("console.log('🦕');"); | ||
console.write_line("close();"); | ||
|
||
let output = console.read_all_output(); | ||
// one for input, one for output | ||
let emoji_count = output.chars().filter(|c| *c == '🦕').count(); | ||
assert_eq!(emoji_count, 2); | ||
}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍
Given:
Before:
After:
Closes #6001
Closes #14516
Closes #14545