-
Notifications
You must be signed in to change notification settings - Fork 30.3k
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
Pasting code into node repl makes it exit on Windows #21773
Comments
I cannot reproduce this. Are you using any console emulator like ConEmu? |
No, I use regular cmd.exe, plain vanilla win10 pro. I tried to do the same on my home PC and I don't have that problem. What could possibly make it fail on my other PC? |
@pps83 could you please
This will allow to check the case when app you are copying from adds some additional characters (like Enter,Ctrl+d that will result in this behavior). Also could you also check if it affects latest node? (10.7.0 at a time of writing). |
I use awesome notepad++, so it's plain text. However, I also RDP to this windows from another windows PC (with no Mac involved at all) and I end up with the same problem. |
I have exactly the same problem. Independently from where I have copied a text from notepad++ or from this thread getting your piece of code literally the nodejs throws me out of REPL into w10 command prompt. |
@pps83 There is not a solution but temporal remedy:
This works for me. Try it on your PC. |
Another option:
|
I'm having this issue too.
Both in PowerShell and CMD. It seems to only happen when more than one line break is in the pasted text. For example, pasting the following code will not cause the REPL to exit. console.log('line 1') // <- there is a line break here
And here's the output.
However, this code will cause the REPL to exit. console.log('line 1')
console.log('line 2') // <- there is a line break here
And here's the output.
@vuGitH's
|
I just tried this on another computer running Windows 10.0.16299.547 and Node.js v8.11.4 and it did not exhibit this problem. Then I tried it on another computer running Windows 10.0.17134.228 and Node.js v8.11.3 and it did exhibit the problem. So maybe something changed in Windows that's contributing to this bug. |
@jordanbtucker Jordan! Thank you for feedback! |
It also reproduces on my box |
Can be reproduced by: require('repl').start({
breakEvalOnSigint: true
}); Switching /cc @nodejs/platform-windows @nodejs/repl |
I assume the key question here is why the process exits, right? Has anybody been able to figure out whether that is because of an emtpy event loop or because of an explicit exit() call somewhere? |
@addaleax Yes, the loop is empty ( |
Can anyone reproduce this on Windows 7? |
Does not reproduce on win7 on my VM. |
Setting the console back into raw mode (https://github.com/nodejs/node/blob/master/lib/repl.js#L338) triggers this. |
This can also be triggered by: process.stdin.on('data', () => {
process.stdin.setRawMode(true);
process.stdin.setRawMode(false);
}); and writing something to |
Because the call to
Things to do:
|
New Windows version requires `EventType`to be set to something meaningful, otherwise WriteConsoleInputW will fail with `ERROR_INVALID_PARAMETER`. This sets it to `FOCUS_EVENT` which is ignored by `uv_process_tty_read_raw_req`. Ref: nodejs/node#21773
PR with libuv fix: libuv/libuv#1989 |
PR-URL: #22886 Refs: #21773 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
PR-URL: #22886 Refs: #21773 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Jeremiah Senkpiel <[email protected]> Reviewed-By: Colin Ihrig <[email protected]>
Reopening until the next libuv update. |
Fixes: nodejs#23043 Fixes: nodejs#21773 Fixes: nodejs#16601 Fixes: nodejs#22999 Fixes: nodejs#23219 Fixes: nodejs#23066 Fixes: nodejs#23067 Fixes: nodejs#23089
PR-URL: #23336 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Fixes: #23043 Fixes: #21773 Fixes: #16601 Fixes: #22999 Fixes: #23219 Fixes: #23066 Fixes: #23067 Fixes: #23089
PR-URL: #23336 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Fixes: #23043 Fixes: #21773 Fixes: #16601 Fixes: #22999 Fixes: #23219 Fixes: #23066 Fixes: #23067 Fixes: #23089
PR-URL: nodejs#23336 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Fixes: nodejs#23043 Fixes: nodejs#21773 Fixes: nodejs#16601 Fixes: nodejs#22999 Fixes: nodejs#23219 Fixes: nodejs#23066 Fixes: nodejs#23067 Fixes: nodejs#23089
Backport-PR-URL: #24103 PR-URL: #23336 Reviewed-By: Anna Henningsen <[email protected]> Reviewed-By: Gus Caplan <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Gireesh Punathil <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Richard Lau <[email protected]> Reviewed-By: Trivikram Kamat <[email protected]> Reviewed-By: Sakthipriyan Vairamani <[email protected]> Fixes: #23043 Fixes: #21773 Fixes: #16601 Fixes: #22999 Fixes: #23219 Fixes: #23066 Fixes: #23067 Fixes: #23089
Node v8.11.2
Win10 Pro
I run node from cmd.exe, and simply paste this code using r-click:
The moment I paste it, node exists and I get this output:
This used to work properly (e.g. it shouldn't exit), that's how I always test snippets by pasting them into node-repl console.
Interesting observation: if I paste incomplete code (without last
}
) then it won't exit and I need to manually complete it with the last brace and can continue. Or, if pasted block doesn't end with a new line character, then it will also won't exist and will wait for manual[ENTER]
key press. Also, to confirm, the problem happens on8.11.3
as wellThe text was updated successfully, but these errors were encountered: