diff options
author | Josh Rahm <joshuarahm@gmail.com> | 2023-11-29 21:52:58 +0000 |
---|---|---|
committer | Josh Rahm <joshuarahm@gmail.com> | 2023-11-29 21:52:58 +0000 |
commit | 931bffbda3668ddc609fc1da8f9eb576b170aa52 (patch) | |
tree | d8c1843a95da5ea0bb4acc09f7e37843d9995c86 /src/nvim/event/process.h | |
parent | 142d9041391780ac15b89886a54015fdc5c73995 (diff) | |
parent | 4a8bf24ac690004aedf5540fa440e788459e5e34 (diff) | |
download | rneovim-userreg.tar.gz rneovim-userreg.tar.bz2 rneovim-userreg.zip |
Merge remote-tracking branch 'upstream/master' into userreguserreg
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 |