diff options
Diffstat (limited to 'src/nvim/event/process.h')
-rw-r--r-- | src/nvim/event/process.h | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/nvim/event/process.h b/src/nvim/event/process.h index e0057faffb..234fc815af 100644 --- a/src/nvim/event/process.h +++ b/src/nvim/event/process.h @@ -1,11 +1,9 @@ -#ifndef NVIM_EVENT_PROCESS_H -#define NVIM_EVENT_PROCESS_H +#pragma once #include <stdbool.h> #include <stddef.h> #include <stdint.h> -#include "nvim/eval/typval.h" #include "nvim/eval/typval_defs.h" #include "nvim/event/loop.h" #include "nvim/event/multiqueue.h" @@ -33,6 +31,7 @@ struct process { uint64_t stopped_time; // process_stop() timestamp const char *cwd; char **argv; + const char *exepath; dict_T *env; Stream in, out, err; /// Exit handler. If set, user must call process_free(). @@ -55,6 +54,7 @@ static inline Process process_init(Loop *loop, ProcessType type, void *data) .stopped_time = 0, .cwd = NULL, .argv = NULL, + .exepath = NULL, .in = { .closed = false }, .out = { .closed = false }, .err = { .closed = false }, @@ -67,6 +67,12 @@ static inline Process process_init(Loop *loop, ProcessType type, void *data) }; } +/// Get the path to the executable of the process. +static inline const char *process_get_exepath(Process *proc) +{ + return proc->exepath != NULL ? proc->exepath : proc->argv[0]; +} + static inline bool process_is_stopped(Process *proc) { bool exited = (proc->status >= 0); @@ -76,4 +82,3 @@ static inline bool process_is_stopped(Process *proc) #ifdef INCLUDE_GENERATED_DECLARATIONS # include "event/process.h.generated.h" #endif -#endif // NVIM_EVENT_PROCESS_H |