mirror of
https://github.com/qvacua/vimr.git
synced 2024-11-24 11:37:32 +03:00
Merge branch 'develop' into issue/339-md-preview
This commit is contained in:
commit
6533cb55cc
@ -5,9 +5,6 @@
|
||||
|
||||
@import Foundation;
|
||||
|
||||
#import <sys/event.h>
|
||||
#import <uv.h>
|
||||
|
||||
#import "NeoVimServer.h"
|
||||
#import "server_globals.h"
|
||||
#import "Logging.h"
|
||||
@ -15,35 +12,33 @@
|
||||
|
||||
|
||||
NeoVimServer *_neovim_server;
|
||||
CFRunLoopRef _mainRunLoop;
|
||||
|
||||
// Ensure that no parent-less NeoVimServer processes are left when the main app crashes.
|
||||
// From http://mac-os-x.10953.n7.nabble.com/Ensure-NSTask-terminates-when-parent-application-does-td31477.html
|
||||
static void observe_parent_termination(void *arg) {
|
||||
pid_t ppid = getppid(); // get parent pid
|
||||
void observe_parent_termination() {
|
||||
pid_t parentPID = getppid();
|
||||
|
||||
int kq = kqueue();
|
||||
if (kq != -1) {
|
||||
struct kevent procEvent; // wait for parent to exit
|
||||
EV_SET(
|
||||
&procEvent, // kevent
|
||||
ppid, // ident
|
||||
EVFILT_PROC, // filter
|
||||
EV_ADD, // flags
|
||||
NOTE_EXIT, // fflags
|
||||
0, // data
|
||||
0 // udata
|
||||
);
|
||||
dispatch_queue_t queue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
|
||||
dispatch_source_t source = dispatch_source_create(
|
||||
DISPATCH_SOURCE_TYPE_PROC, (uintptr_t) parentPID, DISPATCH_PROC_EXIT, queue
|
||||
);
|
||||
|
||||
kevent(kq, &procEvent, 1, &procEvent, 1, 0);
|
||||
if (source == NULL) {
|
||||
WLOG("No parent process monitoring...");
|
||||
return;
|
||||
}
|
||||
|
||||
ILOG("Exiting NeoVimServer: Parent terminated.");
|
||||
exit(0);
|
||||
dispatch_source_set_event_handler(source, ^{
|
||||
WLOG("Exiting neovim server due to parent termination.");
|
||||
quit_neovim();
|
||||
dispatch_source_cancel(source);
|
||||
});
|
||||
|
||||
dispatch_resume(source);
|
||||
}
|
||||
|
||||
int main(int argc, const char *argv[]) {
|
||||
uv_thread_t parent_observer_thread;
|
||||
uv_thread_create(&parent_observer_thread, observe_parent_termination, NULL);
|
||||
_mainRunLoop = CFRunLoopGetCurrent();
|
||||
observe_parent_termination();
|
||||
|
||||
@autoreleasepool {
|
||||
NSArray<NSString *> *arguments = [NSProcessInfo processInfo].arguments;
|
||||
@ -58,5 +53,7 @@ int main(int argc, const char *argv[]) {
|
||||
}
|
||||
|
||||
CFRunLoopRun();
|
||||
|
||||
DLOG("NeoVimServer returning.");
|
||||
return 0;
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
@class NeoVimServer;
|
||||
|
||||
extern NeoVimServer *_neovim_server;
|
||||
extern CFRunLoopRef _mainRunLoop;
|
||||
|
||||
extern void start_neovim();
|
||||
extern void quit_neovim();
|
||||
|
@ -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) {
|
||||
@ -519,7 +517,7 @@ void start_neovim() {
|
||||
|
||||
void quit_neovim() {
|
||||
DLOG("NeoVimServer exiting...");
|
||||
exit(0);
|
||||
CFRunLoopStop(_mainRunLoop);
|
||||
}
|
||||
|
||||
#pragma mark Functions for neovim's main loop
|
||||
|
@ -17,9 +17,9 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.12.5</string>
|
||||
<string>SNAPSHOT-160</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>159</string>
|
||||
<string>160</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
@ -15,11 +15,11 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.12.5</string>
|
||||
<string>SNAPSHOT-160</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>159</string>
|
||||
<string>160</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>Copyright © 2016 Tae Won Ha. All rights reserved.</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
|
@ -15,10 +15,10 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.12.5</string>
|
||||
<string>SNAPSHOT-160</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>159</string>
|
||||
<string>160</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
@ -17,11 +17,11 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.12.5</string>
|
||||
<string>SNAPSHOT-160</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>159</string>
|
||||
<string>160</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
@ -1411,7 +1411,7 @@
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 159;
|
||||
DYLIB_CURRENT_VERSION = 160;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
@ -1435,7 +1435,7 @@
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 159;
|
||||
DYLIB_CURRENT_VERSION = 160;
|
||||
DYLIB_INSTALL_NAME_BASE = "@rpath";
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
@ -1627,7 +1627,7 @@
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 159;
|
||||
CURRENT_PROJECT_VERSION = 160;
|
||||
DEBUG_INFORMATION_FORMAT = dwarf;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
ENABLE_TESTABILITY = YES;
|
||||
@ -1677,7 +1677,7 @@
|
||||
CLANG_WARN_UNREACHABLE_CODE = YES;
|
||||
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
|
||||
COPY_PHASE_STRIP = NO;
|
||||
CURRENT_PROJECT_VERSION = 159;
|
||||
CURRENT_PROJECT_VERSION = 160;
|
||||
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
|
||||
ENABLE_NS_ASSERTIONS = NO;
|
||||
ENABLE_STRICT_OBJC_MSGSEND = YES;
|
||||
|
@ -36,7 +36,7 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.12.5</string>
|
||||
<string>SNAPSHOT-160</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleURLTypes</key>
|
||||
@ -53,7 +53,7 @@
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>159</string>
|
||||
<string>160</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
@ -15,10 +15,10 @@
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>BNDL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.12.5</string>
|
||||
<string>SNAPSHOT-160</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>159</string>
|
||||
<string>160</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
@ -7,22 +7,22 @@
|
||||
<description>Most recent changes with links to updates for VimR.</description>
|
||||
<language>en</language>
|
||||
<item>
|
||||
<title>SNAPSHOT-158</title>
|
||||
<title>SNAPSHOT-160</title>
|
||||
<description><![CDATA[
|
||||
<ul>
|
||||
<li>GH-376: Bugfix, cf. GH-376</li>
|
||||
<li>GH-339: First draft of markdown previewer. Please report issues in GH-339 <a href="https://github.com/qvacua/vimr/issues/339">https://github.com/qvacua/vimr/issues/339</a>.</li>
|
||||
</ul>
|
||||
]]></description>
|
||||
<releaseNotesLink>
|
||||
https://github.com/qvacua/vimr/releases/tag/snapshot/158
|
||||
https://github.com/qvacua/vimr/releases/tag/snapshot/160
|
||||
</releaseNotesLink>
|
||||
<pubDate>2017-01-07T20:29:50.456369</pubDate>
|
||||
<pubDate>2017-01-08T16:18:48.294323</pubDate>
|
||||
<minimumSystemVersion>10.10.0</minimumSystemVersion>
|
||||
<enclosure url="https://github.com/qvacua/vimr/releases/download/snapshot/158/VimR-SNAPSHOT-158.tar.bz2"
|
||||
sparkle:version="158"
|
||||
sparkle:shortVersionString="SNAPSHOT-158"
|
||||
sparkle:dsaSignature="MC0CFG92LrV5qxhgvETvF+5Tarn4uOGlAhUA51FNIy+3zlaMwtGsrRgAzy+69o8="
|
||||
length="9308252"
|
||||
<enclosure url="https://github.com/qvacua/vimr/releases/download/snapshot/160/VimR-SNAPSHOT-160.tar.bz2"
|
||||
sparkle:version="160"
|
||||
sparkle:shortVersionString="SNAPSHOT-160"
|
||||
sparkle:dsaSignature="MCwCFEO9VvVDMijr6WD77f3ygWxe95aGAhQlQqAZa3URSy5wusg7nFWr80ab4A=="
|
||||
length="9555137"
|
||||
type="application/octet-stream"/>
|
||||
</item>
|
||||
</channel>
|
||||
|
Loading…
Reference in New Issue
Block a user