Files
neovim/src/nvim/event/proc.h
Sanzhar Kuandyk 61765b97fe fix(process): avoid inherited stdio for Windows jobs #40074
Problem:
On Windows, channel jobs inherit Nvim's stdio, so a background job
writing to CON (e.g. gutentags) draws onto the TUI and stays until
redraw.

Solution:
Give Windows job stdin/stderr libuv-created pipes (UV_CREATE_PIPE)
instead of inherited fds, so libuv spawns the child with
CREATE_NO_WINDOW and CON writes no longer leak onto the TUI.

(cherry picked from commit 39e9c1754a)
2026-06-29 15:56:30 +00:00

51 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,
.stdio_noinherit = 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"