diff src/os_win32.c @ 8491:daebcbd87bd3 v7.4.1536

commit https://github.com/vim/vim/commit/de27989157f35172b25f9e01e0c147ed8f6ae3ce Author: Bram Moolenaar <Bram@vim.org> Date: Fri Mar 11 22:19:44 2016 +0100 patch 7.4.1536 Problem: Cannot re-use a channel for another job. Solution: Add the "channel" option to job_start().
author Christian Brabandt <cb@256bit.org>
date Fri, 11 Mar 2016 22:30:04 +0100
parents 7376d36395f0
children caed4b2d305f
line wrap: on
line diff
--- a/src/os_win32.c
+++ b/src/os_win32.c
@@ -5138,7 +5138,14 @@ mch_start_job(char *cmd, job_T *job, job
 
     if (!use_null_for_in || !use_null_for_out || !use_null_for_err)
     {
-	channel = add_channel();
+	if (options->jo_set & JO_CHANNEL)
+	{
+	    channel = options->jo_channel;
+	    if (channel != NULL)
+		++channel->ch_refcount;
+	}
+	else
+	    channel = add_channel();
 	if (channel == NULL)
 	    goto failed;
     }
@@ -5188,9 +5195,6 @@ mch_start_job(char *cmd, job_T *job, job
 		      use_out_for_err || use_file_for_err || use_null_for_err
 					    ? INVALID_FD : (sock_T)efd[0]);
 	channel_set_job(channel, job, options);
-#  ifdef FEAT_GUI
-	channel_gui_register(channel);
-#  endif
     }
 # endif
     return;
@@ -5203,7 +5207,7 @@ failed:
     CloseHandle(ifd[1]);
     CloseHandle(ofd[1]);
     CloseHandle(efd[1]);
-    channel_free(channel);
+    channel_unref(channel);
 # else
     ;  /* make compiler happy */
 # endif