summaryrefslogtreecommitdiff
path: root/src/eval.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-02-26 11:17:46 +0100
committerBram Moolenaar <Bram@vim.org>2016-02-26 11:17:46 +0100
commit46c85439c966d7ed39fb3d711d4d6c61ac964647 (patch)
tree9c9530e6f4472e240d23806de7728d2a77b1d766 /src/eval.c
parentc8dcbb12c5d7f3eb0c334daebb4475bb015b91e7 (diff)
downloadvim-46c85439c966d7ed39fb3d711d4d6c61ac964647.zip
patch 7.4.1422
Problem: Error when reading fails uses wrong errno. Keeping channel open after job stops results in test failing. Solution: Move the error up. Add ch_job_killed.
Diffstat (limited to 'src/eval.c')
-rw-r--r--src/eval.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/src/eval.c b/src/eval.c
index 0db6cfac5..f9e85178b 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -7770,8 +7770,11 @@ job_free(job_T *job)
# ifdef FEAT_CHANNEL
if (job->jv_channel != NULL)
{
- /* The channel doesn't count as a references for the job, we need to
- * NULL the reference when the job is freed. */
+ /* The link from the channel to the job doesn't count as a reference,
+ * thus don't decrement the refcount of the job. The reference from
+ * the job to the channel does count the refrence, decrement it and
+ * NULL the reference. We don't set ch_job_killed, unreferencing the
+ * job doesn't mean it stops running. */
job->jv_channel->ch_job = NULL;
channel_unref(job->jv_channel);
}
@@ -15161,7 +15164,14 @@ f_job_stop(typval_T *argvars UNUSED, typval_T *rettv UNUSED)
if (mch_stop_job(job, arg) == FAIL)
rettv->vval.v_number = 0;
else
+ {
rettv->vval.v_number = 1;
+ /* Assume that "hup" does not kill the job. */
+ if (job->jv_channel != NULL && STRCMP(arg, "hup") != 0)
+ job->jv_channel->ch_job_killed = TRUE;
+ }
+ /* We don't try freeing the job, obviously the caller still has a
+ * reference to it. */
}
}
#endif