-
-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
fixed hang issue with --headless and -r option specified #12209
Conversation
Calling the do_more_prompt function in headless mode will freeze neovim because it is eventally in the input-accepting state (the same as waiting for --more--).
By the way, I think this "Press ENTER or type command to continue" message shouldn't be output in headless mode spec, is my understanding correct?
|
Yes, there's even an issue for this: #9358 :). |
A lot of tests have failed... How should I do this? |
If in headless mode, we need to exit at this point. If we continue, we will enter the normal mode and the message "Press ENTER or type command to continue" will be displayed and we will be in the input waiting state.
thanks for tracking this down!
where? on travis I only see this:
|
src/nvim/main.c
Outdated
if (headless_mode) { | ||
msg_putchar('\n'); | ||
return 0; | ||
} |
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.
this probably isn't the right approach. maybe leave this for a separate PR.
headless mode should proceed through normal mode as usual, we can't assume that it should exit here. E.g. some clients may want to connect while nvim --headless
runs as a server. Nvim should exit only if :q
command (or equivalent) was issued.
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.
Thanks.
I understand. I quit to touch this issue (I will focus only for “more”)
@justinmk I think it was difficult. I will try to fix it |
@justinmk The main issue has been fixed. Re-review, please! |
f913ef7
to
baaf986
Compare
-- FIXME(codehex): We should really set a timeout for the system function. | ||
-- If this test fails, there will be a waiting input state. | ||
funcs.system({nvim_prog, '-u', 'NONE', '-c', | ||
'for i in range(1, 100) | echo i | endfor | quit', | ||
'--headless' | ||
}) |
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.
I'm sorry, I didn't think an idea...
baaf986
to
ce019f2
Compare
Probably, travis CI has been broken |
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.
I ran this PR on my local machine and it fixed the exact problem I was having w/ headless mode pausing when I had "a lot" of output.
@justinmk I don't merge C code though as a rule ;) So it's up to you. I have no idea if this is the right fix or not given other factors.
This PR also closes #12299, that's pretty cool! |
ce019f2
to
f763c8e
Compare
CI has been passed. (I tried force-push to rerun CI) |
OK, I'll merge tomorrow if I don't hear any complaints. It looks good to me and is a very small change and tests pass. So seems fine to merge |
@tjdevries merge? 🙏 |
@Code-Hex Thanks for fixing and thanks for the ping. I actually need this for a plugin I'm working on anyway, so I can't deny some selfish motives to checking out the PR myself and running the tests ;) |
* fixed hang issue with --headless and -r option specified Calling the do_more_prompt function in headless mode will freeze neovim because it is eventally in the input-accepting state (the same as waiting for --more--). * fixed "Press ENTER or type command to continue" to be suppressed If in headless mode, we need to exit at this point. If we continue, we will enter the normal mode and the message "Press ENTER or type command to continue" will be displayed and we will be in the input waiting state. * fixed functional ex_cmds tests * Revert "fixed "Press ENTER or type command to continue" to be suppressed" This reverts commit a02dc40. * Revert "fixed functional ex_cmds tests" This reverts commit 3bdb8da. * fixed conditional again * added test for fixed hang issue with --headless (neovim#11386) (cherry picked from commit c6dc397)
* fixed hang issue with --headless and -r option specified Calling the do_more_prompt function in headless mode will freeze neovim because it is eventally in the input-accepting state (the same as waiting for --more--). * fixed "Press ENTER or type command to continue" to be suppressed If in headless mode, we need to exit at this point. If we continue, we will enter the normal mode and the message "Press ENTER or type command to continue" will be displayed and we will be in the input waiting state. * fixed functional ex_cmds tests * Revert "fixed "Press ENTER or type command to continue" to be suppressed" This reverts commit a02dc40. * Revert "fixed functional ex_cmds tests" This reverts commit 3bdb8da. * fixed conditional again * added test for fixed hang issue with --headless (neovim#11386)
Maintenance release for v0.4.x series. FIXES: fd02e63 #12701 ui: fix problem with sattr_T overflow 3e3002b #12710 fs: Ensure FileInfo struct is initialized e4629f2 #12496 main.c: fix hang issue with recoverymode #12520 f558af8 #12209 fixed hang issue with --headless and -r option specified cda1190 #12180 TUI: block signals on suspend 8399f73 #12142 Fix issues revealed by gcc10 setting -fno-common by default 5e47cf2 netrw.vim: do not save +/* registers 5d41bfc #11907 quickfix.c: Fix vimgrep regression 641e229 #11903 screen: add missing redraws after a message 47bd62c loop_close: close all handles d273036 loop_close: call uv_stop(), fix bug 284b398 #11821 loop_close: timout after 2 seconds 1b2666c messages: echo "line1\r\nline2" should not clear line1 1bf90bf #11651 API: fix crash on copy_object(kObjectTypeWindow) fafd636 #11566 libcallnr: Use int, not int64_t, as the return type for Vim compat 972dd75 #11460 win_line: Fix crash with 'rightleft' in :terminal 4c48cf3 f_getenv/setenv: Access v_special when v_type is VAR_SPECIAL 2cd1ff7 #11360 paste: Select-mode, Visual-mode
NVIM v0.4.4 Maintenance release for v0.4.x series. FIXES: fd02e63 neovim#12701 ui: fix problem with sattr_T overflow 3e3002b neovim#12710 fs: Ensure FileInfo struct is initialized e4629f2 neovim#12496 main.c: fix hang issue with recoverymode neovim#12520 f558af8 neovim#12209 fixed hang issue with --headless and -r option specified cda1190 neovim#12180 TUI: block signals on suspend 8399f73 neovim#12142 Fix issues revealed by gcc10 setting -fno-common by default 5e47cf2 netrw.vim: do not save +/* registers 5d41bfc neovim#11907 quickfix.c: Fix vimgrep regression 641e229 neovim#11903 screen: add missing redraws after a message 47bd62c loop_close: close all handles d273036 loop_close: call uv_stop(), fix bug 284b398 neovim#11821 loop_close: timout after 2 seconds 1b2666c messages: echo "line1\r\nline2" should not clear line1 1bf90bf neovim#11651 API: fix crash on copy_object(kObjectTypeWindow) fafd636 neovim#11566 libcallnr: Use int, not int64_t, as the return type for Vim compat 972dd75 neovim#11460 win_line: Fix crash with 'rightleft' in :terminal 4c48cf3 f_getenv/setenv: Access v_special when v_type is VAR_SPECIAL 2cd1ff7 neovim#11360 paste: Select-mode, Visual-mode
* fixed hang issue with --headless and -r option specified Calling the do_more_prompt function in headless mode will freeze neovim because it is eventally in the input-accepting state (the same as waiting for --more--). * fixed "Press ENTER or type command to continue" to be suppressed If in headless mode, we need to exit at this point. If we continue, we will enter the normal mode and the message "Press ENTER or type command to continue" will be displayed and we will be in the input waiting state. * fixed functional ex_cmds tests * Revert "fixed "Press ENTER or type command to continue" to be suppressed" This reverts commit a02dc40. * Revert "fixed functional ex_cmds tests" This reverts commit 3bdb8da. * fixed conditional again * added test for fixed hang issue with --headless (neovim#11386)
fixed #11386 issues.
Calling the do_more_prompt function in headless mode will freeze neovim because it is eventally in the input-accepting state (the same as waiting for --more--).
I have tried
nvim -u NORC -c 'for i in range(0, 1000) | echo i | endfor | quit' --headless
nvim -u NORC -r