aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/nvim/eval.c5
-rw-r--r--src/nvim/os/shell.c9
2 files changed, 14 insertions, 0 deletions
diff --git a/src/nvim/eval.c b/src/nvim/eval.c
index 59363a3608..fc61fed529 100644
--- a/src/nvim/eval.c
+++ b/src/nvim/eval.c
@@ -14492,6 +14492,11 @@ static void get_system_output_as_rettv(typval_T *argvars, typval_T *rettv,
set_vim_var_nr(VV_SHELL_ERROR, (long) status);
if (res == NULL) {
+ if (retlist) {
+ // return an empty list when there's no output
+ rettv->v_type = VAR_LIST;
+ rettv->vval.v_list = list_alloc();
+ }
return;
}
diff --git a/src/nvim/os/shell.c b/src/nvim/os/shell.c
index 7449ac637c..1b279f18f5 100644
--- a/src/nvim/os/shell.c
+++ b/src/nvim/os/shell.c
@@ -244,6 +244,9 @@ static int shell(const char *cmd,
job_stop(job);
return -1;
}
+ // close the input stream after everything is written
+ job_write_cb(job, shell_write_cb);
+ } else {
// close the input stream, let the process know that no more input is
// coming
job_close_in(job);
@@ -447,3 +450,9 @@ static void write_output(char *output, size_t remaining)
curbuf->b_no_eol_lnum = 0;
}
}
+
+static void shell_write_cb(WStream *wstream, void *data, int status)
+{
+ Job *job = data;
+ job_close_in(job);
+}