repl: handle dot commands in multiline input#63889
Conversation
| // prompt, while keeping the previous lines buffered. | ||
| if (self.terminal && | ||
| !self[kBufferedCommandSymbol] && | ||
| StringPrototypeIncludes(cmd, '\n')) { |
There was a problem hiding this comment.
I tested the changes on Windows, and the issue does not appear to be resolved yet. From my debugging, it looks like this condition-based check is not getting satisfied, so the logic may need additional updates.
There was a problem hiding this comment.
Thanks for testing this on Windows. You were right — the previous guard missed a real continuation-prompt shape because the buffered command can already be set.
I've updated the fix so TTY multiline input still checks the newest physical line for registered REPL dot commands even when a buffered command exists. If the buffer is already active, it is preserved; otherwise the previous physical lines are moved into the existing REPL buffer. The command is then dispatched through the existing REPL keyword handling path.
I also adjusted the regression tests to cover both the full editable multiline buffer path and the buffered continuation prompt path for .break, .help, and .exit.
Validation run locally:
node --check lib/repl.jsnode --check test/parallel/test-repl-multiline.jsgit diff --check
I still cannot run the full test runner locally because this checkout does not currently have a built Node binary (Release/node.exe is missing).
There was a problem hiding this comment.
While digging more I figured out an alternate fix and created a PR for it.
#63911
There was a problem hiding this comment.
Maybe you should try to install Rust in your Windows. Recent changes for Temporal API need rust and cargo to build Node binary.
Fixes: nodejs#63864 Refs: nodejs#63889 Update conditional logic to correctly handle dot commands in multiline REPL input
Fixes: nodejs#63864 Refs: nodejs#63889 Update conditional logic to correctly handle dot commands in multiline REPL input
Fixes: nodejs#63864 Refs: nodejs#63889 Update conditional logic to correctly handle dot commands in multiline REPL input
Update conditional logic to correctly handle dot commands in multiline REPL input Fixes: nodejs#63864 Refs: nodejs#63889 Signed-off-by: SudhansuBandha bandhasudhansu@gmail.com
Update conditional logic to correctly handle dot commands in multiline REPL input Fixes: nodejs#63864 Refs: nodejs#63889 Signed-off-by: SudhansuBandha bandhasudhansu@gmail.com
Update conditional logic to correctly handle dot commands in multiline REPL input Fixes: nodejs#63864 Refs: nodejs#63889 Signed-off-by: SudhansuBandha <bandhasudhansu@gmail.com>
Update conditional logic to correctly handle dot commands in multiline REPL input Fixes: nodejs#63864 Refs: nodejs#63889 Signed-off-by: SudhansuBandha <bandhasudhansu@gmail.com>
Update conditional logic to correctly handle dot commands in multiline REPL input Fixes: nodejs#63864 Refs: nodejs#63889 Signed-off-by: SudhansuBandha <bandhasudhansu@gmail.com>
|
Thanks for taking another look and for opening #63911. I'll review the alternate approach and compare it with my current patch, especially around the buffered continuation prompt path and the regression coverage for Thanks also for the Rust/Cargo heads-up. I'll install Rust on my Windows setup so I can build the current Node tree and run the full REPL test locally. |
Fixes: #63864
This restores REPL dot-command handling when a command is entered from a TTY multiline continuation prompt.
Since TTY multiline input can arrive as one editable buffer like
function a() {\n.break, the previous command detection only checked the beginning of the full buffer and sent.break,.help, and.exitto JavaScript evaluation, producingUncaught SyntaxError: Unexpected token '.'.This change checks the newest physical line for registered REPL dot-commands in the TTY multiline case, keeps the preceding lines in the existing buffered-command path, and dispatches the dot-command through the existing REPL keyword handling.
Added regression coverage for:
.breakafter a recoverable multiline input.helpafter a recoverable multiline input.exitafter a recoverable multiline inputValidation:
node --check lib/repl.jsnode --check test/parallel/test-repl-multiline.jsgit diff --checkNote: I could not run
python tools/test.py test/parallel/test-repl-multiline.jslocally because this Windows checkout does not currently have a built Node binary.