1
1
mirror of https://github.com/qvacua/vimr.git synced 2024-11-24 11:37:32 +03:00

Stop run loop instead of exit(0)

This commit is contained in:
Tae Won Ha 2017-01-08 19:01:34 +01:00
parent 0a94c43a9b
commit 00137e144e
No known key found for this signature in database
GPG Key ID: E40743465B5B8B44
3 changed files with 7 additions and 7 deletions

View File

@ -29,7 +29,7 @@ void observe_parent_termination() {
dispatch_source_set_event_handler(source, ^{
WLOG("Exiting neovim server due to parent termination.");
CFRunLoopStop(_mainRunLoop);
quit_neovim();
dispatch_source_cancel(source);
});
@ -53,6 +53,7 @@ int main(int argc, const char *argv[]) {
}
CFRunLoopRun();
WLOG("Returning neovim server");
WLOG("NeoVimServer returning.");
return 0;
}

View File

@ -9,6 +9,7 @@
@class NeoVimServer;
extern NeoVimServer *_neovim_server;
extern CFRunLoopRef _mainRunLoop;
extern void start_neovim();
extern void quit_neovim();

View File

@ -119,9 +119,7 @@ static void run_neovim(void *arg __unused) {
char *argv[1];
argv[0] = "nvim";
int returnCode = nvim_main(1, argv);
NSLog(@"neovim's main returned with code: %d\n", returnCode);
nvim_main(1, argv);
}
static void set_ui_size(UIBridgeData *bridge, int width, int height) {
@ -518,8 +516,8 @@ void start_neovim() {
}
void quit_neovim() {
DLOG("NeoVimServer exiting...");
exit(0);
WLOG("NeoVimServer exiting...");
CFRunLoopStop(_mainRunLoop);
}
#pragma mark Functions for neovim's main loop