#ifndef NVIM_EVENT_PROCESS_H #define NVIM_EVENT_PROCESS_H #include "nvim/event/loop.h" #include "nvim/event/rstream.h" #include "nvim/event/wstream.h" typedef enum { kProcessTypeUv, kProcessTypePty } ProcessType; typedef struct process Process; typedef void (*process_exit_cb)(Process *proc, int status, void *data); typedef void (*internal_process_cb)(Process *proc); struct process { ProcessType type; Loop *loop; void *data; int pid, status, refcount; // set to the hrtime of when process_stop was called for the process. uint64_t stopped_time; const char *cwd; char **argv; Stream *in, *out, *err; process_exit_cb cb; internal_process_cb internal_exit_cb, internal_close_cb; bool closed, detach; MultiQueue *events; }; static inline Process process_init(Loop *loop, ProcessType type, void *data) { return (Process) { .type = type, .data = data, .loop = loop, .events = NULL, .pid = 0, .status = 0, .refcount = 0, .stopped_time = 0, .cwd = NULL, .argv = NULL, .in = NULL, .out = NULL, .err = NULL, .cb = NULL, .closed = false, .internal_close_cb = NULL, .internal_exit_cb = NULL, .detach = false }; } #ifdef INCLUDE_GENERATED_DECLARATIONS # include "event/process.h.generated.h" #endif #endif // NVIM_EVENT_PROCESS_H