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

Fails to stop scheme REPL(s) when exiting with :cq #522

Closed
carlinigraphy opened this issue Aug 3, 2023 · 5 comments
Closed

Fails to stop scheme REPL(s) when exiting with :cq #522

carlinigraphy opened this issue Aug 3, 2023 · 5 comments
Labels
bug Something isn't working client-scheme

Comments

@carlinigraphy
Copy link

When exiting vim with :cq, the automatically launched REPL is not
stopped. As far as I understand, :cq only differs from :qa by
exiting with a non-0 status.

To reproduce:

nvim tmp.scm ; ps aux | grep petite

When in vim, exit with :cq. 100% of the time :cq leaves a petite
processing running, which seems to hang and immediately spin up my CPU
to maximum. This is not the case with :qa.

Unfortunately I am not sufficiently versed in Fennel (or lisps in
general) to read the code and find the root problem, though I tried.

  • Neovim version: v0.9.1
  • Conjure version: v4.46.0 (latest)
  • Config (packer):
use({'Olical/conjure',
   ft = { 'scheme' },
   config = function()
      vim.g['conjure#client#scheme#stdio#command'] = 'petite'
      vim.g['conjure#client#scheme#stdio#prompt_pattern'] = '> $?'
      vim.g['conjure#client#scheme#stdio#value_prefix_pattern'] = false
   end,
})
@russtoku
Copy link
Contributor

russtoku commented Aug 4, 2023

I can duplicate the problem on a 13" Early 2015 Macbook Air running macOS Monterey (12.6.8). After quitting with :cq, a petite process is still running. Quitting with :qa leaves no petite process running.

I found a similar issue for Plenary, nvim-lua/plenary.nvim#328. It suggests that a VimLeavePre autocmd might be the cure. The issue has some comments that show how it might be done. Conjure currently has one that for dealing with the conjure.log file. There are additional autocmds for ExitPre and QuitPre.

I can take a stab at a fix.

@Olical Olical added bug Something isn't working client-scheme labels Aug 4, 2023
@Olical
Copy link
Owner

Olical commented Aug 4, 2023

Ah hah! So I didn't read your comment carefully enough and also found VimLeavePre in the :help texts, same conclusion. I'm just trying it out now and adding it in. Thanks for the report and the research!

@Olical
Copy link
Owner

Olical commented Aug 4, 2023

So I guess this has something to do with Neovim configuration or OS? Because I can't reproduce this with Guile or Petite on Arch Linux, it exits exactly as expected.

I have however swapped the on-exit hook in Conjure over to the VimLeavePre autocmd on the develop branch which does seem to be the correct one. Let me know if that does the trick for you!

@russtoku
Copy link
Contributor

russtoku commented Aug 4, 2023

Thanks! I confirmed that on macOS (formerly known as OS X) your fix works. Both :cq and :qa exit nvim without leaving a running petite process running.

@ThenWhenceComethEvil, what OS are you using? Does this fix work for you?

@carlinigraphy
Copy link
Author

Just validated on my machine, the referenced commit does fix the issue. Thank you both for your quick response.

Ugh, unfortunately I use Arch, by the way.

@Olical Olical closed this as completed Aug 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working client-scheme
Projects
None yet
Development

No branches or pull requests

3 participants