aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/event
diff options
context:
space:
mode:
authorJustin M. Keyes <justinkz@gmail.com>2025-02-10 10:21:47 -0800
committerGitHub <noreply@github.com>2025-02-10 10:21:47 -0800
commitc7d13f2895fa657ff3d9d45741f9abec25072b56 (patch)
tree0b61d786b8fb318a0e9b2c53eb633332af5aa05d /src/nvim/event
parentad60b3fb4806c0917010bbe97876c22fb57cabcd (diff)
parenta1906c23ddab6fa4d15bc5ceddee97df8034d8cb (diff)
downloadrneovim-c7d13f2895fa657ff3d9d45741f9abec25072b56.tar.gz
rneovim-c7d13f2895fa657ff3d9d45741f9abec25072b56.tar.bz2
rneovim-c7d13f2895fa657ff3d9d45741f9abec25072b56.zip
Merge #32385 UI :detach command
Diffstat (limited to 'src/nvim/event')
-rw-r--r--src/nvim/event/proc.c16
-rw-r--r--src/nvim/event/stream.c3
2 files changed, 10 insertions, 9 deletions
diff --git a/src/nvim/event/proc.c b/src/nvim/event/proc.c
index 37cb102d11..e32bbbc29a 100644
--- a/src/nvim/event/proc.c
+++ b/src/nvim/event/proc.c
@@ -315,10 +315,8 @@ static void decref(Proc *proc)
static void proc_close(Proc *proc)
FUNC_ATTR_NONNULL_ARG(1)
{
- if (proc_is_tearing_down && (proc->detach || proc->type == kProcTypePty)
- && proc->closed) {
- // If a detached/pty process dies while tearing down it might get closed
- // twice.
+ if (proc_is_tearing_down && proc->closed && (proc->detach || proc->type == kProcTypePty)) {
+ // If a detached/pty process dies while tearing down it might get closed twice.
return;
}
assert(!proc->closed);
@@ -427,19 +425,21 @@ static void exit_event(void **argv)
}
}
-void exit_from_channel(int status)
+/// Performs self-exit because the primary RPC channel was closed.
+void exit_on_closed_chan(int status)
{
+ DLOG("self-exit triggered by closed RPC channel...");
multiqueue_put(main_loop.fast_events, exit_event, (void *)(intptr_t)status);
}
static void on_proc_exit(Proc *proc)
{
Loop *loop = proc->loop;
- ILOG("exited: pid=%d status=%d stoptime=%" PRIu64, proc->pid, proc->status,
- proc->stopped_time);
+ ILOG("child exited: pid=%d status=%d" PRIu64, proc->pid, proc->status);
+ // XXX: This assumes the TUI never spawns any other processes...?
if (ui_client_channel_id) {
- exit_from_channel(proc->status);
+ exit_on_closed_chan(proc->status);
}
// Process has terminated, but there could still be data to be read from the
diff --git a/src/nvim/event/stream.c b/src/nvim/event/stream.c
index 9c155b55ea..3e32813e1c 100644
--- a/src/nvim/event/stream.c
+++ b/src/nvim/event/stream.c
@@ -104,9 +104,10 @@ void stream_may_close(Stream *stream, bool rstream)
if (stream->closed) {
return;
}
- assert(!stream->closed);
DLOG("closing Stream: %p", (void *)stream);
stream->closed = true;
+ // TODO(justinmk): stream->close_cb is never actually invoked. Either remove it, or see if it can
+ // be used somewhere...
stream->close_cb = NULL;
stream->close_cb_data = NULL;