mirror of
https://github.com/neovim/neovim.git
synced 2025-09-28 14:08:32 +00:00
Re-integrate FEAT_FILTERPIPE code
This feature was accidentally removed when doing the initial import from vim. It makes vim use pipes instead of temporary files for filtering buffers through shell commands. I found that this was missing when looking for references of SHELL_READ/SHELL_WRITE outside mch_call_shell`. When `mch_call_shell` is reimplemented on top of libuv process management facilities, pipes will always be used for communication with child processes so it makes sense to enable the feature permanently.
This commit is contained in:
@@ -1024,7 +1024,23 @@ do_filter (
|
||||
if (do_out)
|
||||
shell_flags |= SHELL_DOOUT;
|
||||
|
||||
if ((do_in && (itmp = vim_tempname('i')) == NULL)
|
||||
if (!do_in && do_out && !p_stmp) {
|
||||
// Use a pipe to fetch stdout of the command, do not use a temp file.
|
||||
shell_flags |= SHELL_READ;
|
||||
curwin->w_cursor.lnum = line2;
|
||||
} else if (do_in && !do_out && !p_stmp) {
|
||||
// Use a pipe to write stdin of the command, do not use a temp file.
|
||||
shell_flags |= SHELL_WRITE;
|
||||
curbuf->b_op_start.lnum = line1;
|
||||
curbuf->b_op_end.lnum = line2;
|
||||
} else if (do_in && do_out && !p_stmp) {
|
||||
// Use a pipe to write stdin and fetch stdout of the command, do not
|
||||
// use a temp file.
|
||||
shell_flags |= SHELL_READ|SHELL_WRITE;
|
||||
curbuf->b_op_start.lnum = line1;
|
||||
curbuf->b_op_end.lnum = line2;
|
||||
curwin->w_cursor.lnum = line2;
|
||||
} else if ((do_in && (itmp = vim_tempname('i')) == NULL)
|
||||
|| (do_out && (otmp = vim_tempname('o')) == NULL)) {
|
||||
EMSG(_(e_notmp));
|
||||
goto filterend;
|
||||
|
Reference in New Issue
Block a user