aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/event
diff options
context:
space:
mode:
authorAleksa Sarai <cyphar@cyphar.com>2016-06-07 03:48:03 +1000
committerAleksa Sarai <cyphar@cyphar.com>2016-06-07 03:48:03 +1000
commit2c44d9257287c3e804dcc5a2bfe073c20554c0b9 (patch)
tree5b1623c1ced01b4d08c3bd1834fcf3a33780130b /src/nvim/event
parent999590b313ef32ca29c4ddba20c5b719730ee7ff (diff)
downloadrneovim-2c44d9257287c3e804dcc5a2bfe073c20554c0b9.tar.gz
rneovim-2c44d9257287c3e804dcc5a2bfe073c20554c0b9.tar.bz2
rneovim-2c44d9257287c3e804dcc5a2bfe073c20554c0b9.zip
eval: allow setting cwd in {jobstart,termopen}()
Processes in vim are always started in the current directory, which causes issues when the process is a daemon and the current directory is a mountpoint. Fix this by adding an option to set the cwd of the new process with jobstart(). In addition, fix termopen() so that it actually uses the cwd option from the dict (it couldn't previously set the cwd value due to dead code). Signed-off-by: Aleksa Sarai <cyphar@cyphar.com>
Diffstat (limited to 'src/nvim/event')
-rw-r--r--src/nvim/event/libuv_process.c2
-rw-r--r--src/nvim/event/process.h2
2 files changed, 3 insertions, 1 deletions
diff --git a/src/nvim/event/libuv_process.c b/src/nvim/event/libuv_process.c
index 9ef3468284..a68badcc8f 100644
--- a/src/nvim/event/libuv_process.c
+++ b/src/nvim/event/libuv_process.c
@@ -25,7 +25,7 @@ bool libuv_process_spawn(LibuvProcess *uvproc)
uvproc->uvopts.flags |= UV_PROCESS_DETACHED;
}
uvproc->uvopts.exit_cb = exit_cb;
- uvproc->uvopts.cwd = NULL;
+ uvproc->uvopts.cwd = proc->cwd;
uvproc->uvopts.env = NULL;
uvproc->uvopts.stdio = uvproc->uvstdio;
uvproc->uvopts.stdio_count = 3;
diff --git a/src/nvim/event/process.h b/src/nvim/event/process.h
index e23c8ea60f..a4c6e7eeb2 100644
--- a/src/nvim/event/process.h
+++ b/src/nvim/event/process.h
@@ -21,6 +21,7 @@ struct process {
int pid, status, refcount;
// set to the hrtime of when process_stop was called for the process.
uint64_t stopped_time;
+ char *cwd;
char **argv;
Stream *in, *out, *err;
process_exit_cb cb;
@@ -40,6 +41,7 @@ static inline Process process_init(Loop *loop, ProcessType type, void *data)
.status = 0,
.refcount = 0,
.stopped_time = 0,
+ .cwd = NULL,
.argv = NULL,
.in = NULL,
.out = NULL,