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.
diff --git a/src/eval.c b/src/eval.c
index 0db6cfa..f9e8517 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -7770,8 +7770,11 @@
# 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 @@
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