aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/event/process.h
diff options
context:
space:
mode:
authorJosh Rahm <joshuarahm@gmail.com>2023-11-30 20:35:25 +0000
committerJosh Rahm <joshuarahm@gmail.com>2023-11-30 20:35:25 +0000
commit1b7b916b7631ddf73c38e3a0070d64e4636cb2f3 (patch)
treecd08258054db80bb9a11b1061bb091c70b76926a /src/nvim/event/process.h
parenteaa89c11d0f8aefbb512de769c6c82f61a8baca3 (diff)
parent4a8bf24ac690004aedf5540fa440e788459e5e34 (diff)
downloadrneovim-aucmd_textputpost.tar.gz
rneovim-aucmd_textputpost.tar.bz2
rneovim-aucmd_textputpost.zip
Merge remote-tracking branch 'upstream/master' into aucmd_textputpostaucmd_textputpost
Diffstat (limited to 'src/nvim/event/process.h')
-rw-r--r--src/nvim/event/process.h13
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