mirror of
https://github.com/vim/vim.git
synced 2025-09-24 03:44:06 -04:00
patch 7.4.1484
Problem: Channel "err-io" value "out" is not supported. Solution: Connect stderr to stdout if wanted.
This commit is contained in:
@@ -5045,6 +5045,7 @@ mch_start_job(char **argv, job_T *job, jobopt_T *options)
|
||||
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 @@ mch_start_job(char **argv, job_T *job, jobopt_T *options)
|
||||
/* 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 @@ mch_start_job(char **argv, job_T *job, jobopt_T *options)
|
||||
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 @@ mch_start_job(char **argv, job_T *job, jobopt_T *options)
|
||||
/* 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
|
||||
|
Reference in New Issue
Block a user