Olical / conjure

Interactive evaluation for Neovim (Clojure, Fennel, Janet, Racket, Hy, MIT Scheme, Guile, Python and more!)
https://conjure.oli.me.uk
The Unlicense
1.8k stars 111 forks source link

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

Closed carlinigraphy closed 1 year ago

carlinigraphy commented 1 year ago

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.

russtoku commented 1 year ago

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, https://github.com/nvim-lua/plenary.nvim/issues/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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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.