patch 7.4.1484
Problem: Channel "err-io" value "out" is not supported.
Solution: Connect stderr to stdout if wanted.
diff --git a/src/os_unix.c b/src/os_unix.c
index 9343996..8e5ac6c 100644
--- a/src/os_unix.c
+++ b/src/os_unix.c
@@ -5045,6 +5045,7 @@
int fd_err[2]; /* for stderr */
# ifdef FEAT_CHANNEL
channel_T *channel = NULL;
+ int use_out_for_err = options->jo_io[PART_ERR] == JIO_OUT;
#endif
/* default is to fail */
@@ -5056,7 +5057,8 @@
/* TODO: without the channel feature connect the child to /dev/null? */
# ifdef FEAT_CHANNEL
/* Open pipes for stdin, stdout, stderr. */
- if ((pipe(fd_in) < 0) || (pipe(fd_out) < 0) ||(pipe(fd_err) < 0))
+ if (pipe(fd_in) < 0 || pipe(fd_out) < 0
+ || (!use_out_for_err && pipe(fd_err) < 0))
goto failed;
channel = add_channel();
@@ -5093,17 +5095,26 @@
ignored = dup(fd_in[0]);
close(fd_in[0]);
+ /* set up stderr for the child */
+ if (use_out_for_err)
+ {
+ close(2);
+ ignored = dup(fd_out[1]);
+ }
+ else
+ {
+ close(fd_err[0]);
+ close(2);
+ ignored = dup(fd_err[1]);
+ close(fd_err[1]);
+ }
+
/* set up stdout for the child */
close(fd_out[0]);
close(1);
ignored = dup(fd_out[1]);
close(fd_out[1]);
- /* set up stderr for the child */
- close(fd_err[0]);
- close(2);
- ignored = dup(fd_err[1]);
- close(fd_err[1]);
# endif
/* See above for type of argv. */
@@ -5123,9 +5134,13 @@
/* child stdin, stdout and stderr */
close(fd_in[0]);
close(fd_out[1]);
- close(fd_err[1]);
# ifdef FEAT_CHANNEL
- channel_set_pipes(channel, fd_in[1], fd_out[0], fd_err[0]);
+ if (!use_out_for_err)
+# endif
+ close(fd_err[1]);
+# ifdef FEAT_CHANNEL
+ channel_set_pipes(channel, fd_in[1], fd_out[0],
+ use_out_for_err ? INVALID_FD : fd_err[0]);
channel_set_job(channel, job);
channel_set_options(channel, options);
# ifdef FEAT_GUI