skywind3000 / asyncrun.vim

:rocket: Run Async Shell Commands in Vim 8.0 / NeoVim and Output to the Quickfix Window !!
https://www.vim.org/scripts/script.php?script_id=5431
MIT License
1.84k stars 109 forks source link

Vim hangs in infinity loop with printf (language: C) command #211

Closed TornaxO7 closed 3 years ago

TornaxO7 commented 3 years ago

This is a minimal example in C:

#include <stdio.h>
#include <stdlib.h>

int main () {

    while (1) {
        printf("Houston, we've a problem...\n");
    }

    return EXIT_SUCCESS;
}

If I run it with this command:

:AsyncRun -mode=async -cwd="$(VIM_FILEDIR)" -save=2 gcc % && ./a.out

than vim hangs up and the memory usage increases until my pc hangs up unless I kill the process manually.

The moment when you see the output at bottom appears if I hit Ctrl + c. I can't stop it with :AsyncStop since (neo)vim is stuck.

GIF

skywind3000 commented 3 years ago

try

:AsyncRun -mode=term -pos=tab -cwd="$(VIM_FILEDIR)" -save=2 gcc % && ./a.out
TornaxO7 commented 3 years ago

It's working with your command now and I can cancel it with Ctrl+c, thanks! But it'd be nice if I could see the output at the bottom ^^ should I close this issue?

skywind3000 commented 3 years ago

neovim's quickfix is inefficient, and job api is lack of flow control. asyncrun has nothing to do with it.

TornaxO7 commented 3 years ago

Ok, thanks for the information!