Files
neovim/src/nvim/event/proc.h
zeertzjq 066891f5d3 revert: "fix(tui): server --listen error sometimes not visible (#38027)" (#38175)
This reverts commit ab8371a26c.

Need to think of a different solution, which may require adding new
flags to nvim_ui_attach() (e.g. passing stdout or stderr fd).
2026-03-06 08:49:09 +08:00

50 lines
1.1 KiB
C

#pragma once
#include <stdbool.h>
#include <stddef.h>
#include "nvim/event/defs.h" // IWYU pragma: keep
#include "nvim/os/os_defs.h"
#include "nvim/types_defs.h"
static inline Proc proc_init(Loop *loop, ProcType type, void *data)
{
return (Proc) {
.type = type,
.data = data,
.loop = loop,
.events = NULL,
.pid = 0,
.status = -1,
.refcount = 0,
.stopped_time = 0,
.cwd = NULL,
.argv = NULL,
.exepath = NULL,
.in = { .closed = false },
.out = { .s.closed = false, .s.fd = STDOUT_FILENO },
.err = { .s.closed = false, .s.fd = STDERR_FILENO },
.cb = NULL,
.state_cb = NULL,
.closed = false,
.internal_close_cb = NULL,
.internal_exit_cb = NULL,
.detach = false,
.fwd_err = false,
};
}
/// Get the path to the executable of the process.
static inline const char *proc_get_exepath(Proc *proc)
{
return proc->exepath != NULL ? proc->exepath : proc->argv[0];
}
static inline bool proc_is_stopped(Proc *proc)
{
bool exited = (proc->status >= 0);
return exited || (proc->stopped_time != 0);
}
#include "event/proc.h.generated.h"