diff options
author | Thiago de Arruda <tpadilha84@gmail.com> | 2014-11-03 21:59:18 -0300 |
---|---|---|
committer | Thiago de Arruda <tpadilha84@gmail.com> | 2014-11-03 21:59:18 -0300 |
commit | 13a38ff688cbe7a5e6d499cc8d3d1642b61cdf9e (patch) | |
tree | 4983dddb60c235c9ac63a962037df1c53974b003 /src | |
parent | eeaac9f639483e10b9d9db103bb1eb0da5d4bfe6 (diff) | |
parent | 7cff10a6c56c662104cb1f9145ab45c94da4862d (diff) | |
download | rneovim-13a38ff688cbe7a5e6d499cc8d3d1642b61cdf9e.tar.gz rneovim-13a38ff688cbe7a5e6d499cc8d3d1642b61cdf9e.tar.bz2 rneovim-13a38ff688cbe7a5e6d499cc8d3d1642b61cdf9e.zip |
Merge PR #1384 'Add core dump reporting to travis'
Diffstat (limited to 'src')
-rw-r--r-- | src/nvim/msgpack_rpc/channel.c | 7 | ||||
-rw-r--r-- | src/nvim/os/event.c | 21 |
2 files changed, 20 insertions, 8 deletions
diff --git a/src/nvim/msgpack_rpc/channel.c b/src/nvim/msgpack_rpc/channel.c index 10d180b3b7..c2d16d170f 100644 --- a/src/nvim/msgpack_rpc/channel.c +++ b/src/nvim/msgpack_rpc/channel.c @@ -600,11 +600,16 @@ static void close_channel(Channel *channel) if (handle) { uv_close(handle, close_cb); } else { - mch_exit(0); + event_push((Event) { .handler = on_stdio_close }, false); } } } +static void on_stdio_close(Event e) +{ + mch_exit(0); +} + static void free_channel(Channel *channel) { pmap_del(uint64_t)(channels, channel->id); diff --git a/src/nvim/os/event.c b/src/nvim/os/event.c index ecaec0b9ce..5a5da5cd63 100644 --- a/src/nvim/os/event.c +++ b/src/nvim/os/event.c @@ -39,7 +39,7 @@ typedef struct { // immediate_events: Events that should be processed after exiting libuv event // loop(to avoid recursion), but before returning from // `event_poll` -static klist_t(Event) *deferred_events, *immediate_events; +static klist_t(Event) *deferred_events = NULL, *immediate_events = NULL; void event_init(void) { @@ -68,18 +68,25 @@ void event_init(void) void event_teardown(void) { + if (!deferred_events) { + // Not initialized(possibly a --version invocation) + return; + } + channel_teardown(); job_teardown(); server_teardown(); signal_teardown(); input_stop(); input_teardown(); - do { - // This will loop forever if we leave any unclosed handles. Currently it is - // the most reliable way to use travis for verifying the no libuv-related - // bugs(which can be hard to track later) were introduced on a PR. - uv_run(uv_default_loop(), UV_RUN_DEFAULT); - } while (uv_loop_close(uv_default_loop())); + // this last `uv_run` will return after all handles are stopped, it will + // also take care of finishing any uv_close calls made by other *_teardown + // functions. + uv_run(uv_default_loop(), UV_RUN_DEFAULT); + // abort that if we left unclosed handles + if (uv_loop_close(uv_default_loop())) { + abort(); + } } // Wait for some event |