mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
do_shell, do_filter: Remove "clear screen", "wait for return" calls
The output from shell commands is already handled by the messages.c/UI layer.
This commit is contained in:
parent
31c3d54668
commit
90b7d25882
@ -1185,19 +1185,8 @@ static void do_filter(
|
|||||||
}
|
}
|
||||||
read_linecount = curbuf->b_ml.ml_line_count;
|
read_linecount = curbuf->b_ml.ml_line_count;
|
||||||
|
|
||||||
// When call_shell() fails wait_return() is called to give the user a chance
|
|
||||||
// to read the error messages. Otherwise errors are ignored, so you can see
|
|
||||||
// the error messages from the command that appear on stdout; use 'u' to fix
|
|
||||||
// the text.
|
|
||||||
// Pass on the kShellOptDoOut flag when the output is being redirected.
|
// Pass on the kShellOptDoOut flag when the output is being redirected.
|
||||||
if (call_shell(
|
call_shell(cmd_buf, kShellOptFilter | shell_flags, NULL);
|
||||||
cmd_buf,
|
|
||||||
kShellOptFilter | shell_flags,
|
|
||||||
NULL
|
|
||||||
)) {
|
|
||||||
redraw_later_clear();
|
|
||||||
wait_return(FALSE);
|
|
||||||
}
|
|
||||||
xfree(cmd_buf);
|
xfree(cmd_buf);
|
||||||
|
|
||||||
did_check_timestamps = FALSE;
|
did_check_timestamps = FALSE;
|
||||||
@ -1298,23 +1287,17 @@ filterend:
|
|||||||
xfree(otmp);
|
xfree(otmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
// Call a shell to execute a command.
|
||||||
* Call a shell to execute a command.
|
// When "cmd" is NULL start an interactive shell.
|
||||||
* When "cmd" is NULL start an interactive shell.
|
|
||||||
*/
|
|
||||||
void
|
void
|
||||||
do_shell(
|
do_shell(
|
||||||
char_u *cmd,
|
char_u *cmd,
|
||||||
int flags // may be SHELL_DOOUT when output is redirected
|
int flags // may be SHELL_DOOUT when output is redirected
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int save_nwr;
|
// Disallow shell commands in restricted mode (-Z)
|
||||||
|
// Disallow shell commands from .exrc and .vimrc in current directory for
|
||||||
/*
|
// security reasons.
|
||||||
* Disallow shell commands in restricted mode (-Z)
|
|
||||||
* Disallow shell commands from .exrc and .vimrc in current directory for
|
|
||||||
* security reasons.
|
|
||||||
*/
|
|
||||||
if (check_restricted() || check_secure()) {
|
if (check_restricted() || check_secure()) {
|
||||||
msg_end();
|
msg_end();
|
||||||
return;
|
return;
|
||||||
@ -1352,33 +1335,7 @@ do_shell(
|
|||||||
msg_row = Rows - 1;
|
msg_row = Rows - 1;
|
||||||
msg_col = 0;
|
msg_col = 0;
|
||||||
|
|
||||||
if (autocmd_busy) {
|
// display any error messages now
|
||||||
if (msg_silent == 0)
|
|
||||||
redraw_later_clear();
|
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
* For ":sh" there is no need to call wait_return(), just redraw.
|
|
||||||
* Also for the Win32 GUI (the output is in a console window).
|
|
||||||
* Otherwise there is probably text on the screen that the user wants
|
|
||||||
* to read before redrawing, so call wait_return().
|
|
||||||
*/
|
|
||||||
if (cmd == NULL
|
|
||||||
) {
|
|
||||||
if (msg_silent == 0)
|
|
||||||
redraw_later_clear();
|
|
||||||
need_wait_return = FALSE;
|
|
||||||
} else {
|
|
||||||
/*
|
|
||||||
* If we switch screens when starttermcap() is called, we really
|
|
||||||
* want to wait for "hit return to continue".
|
|
||||||
*/
|
|
||||||
save_nwr = no_wait_return;
|
|
||||||
wait_return(msg_silent == 0);
|
|
||||||
no_wait_return = save_nwr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* display any error messages now */
|
|
||||||
display_errors();
|
display_errors();
|
||||||
|
|
||||||
apply_autocmds(EVENT_SHELLCMDPOST, NULL, NULL, FALSE, curbuf);
|
apply_autocmds(EVENT_SHELLCMDPOST, NULL, NULL, FALSE, curbuf);
|
||||||
|
@ -2707,8 +2707,10 @@ void fast_breakcheck(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// os_call_shell wrapper. Handles 'verbose', :profile, and v:shell_error.
|
/// os_call_shell() wrapper. Handles 'verbose', :profile, and v:shell_error.
|
||||||
// Invalidates cached tags.
|
/// Invalidates cached tags.
|
||||||
|
///
|
||||||
|
/// @return shell command exit code
|
||||||
int call_shell(char_u *cmd, ShellOpts opts, char_u *extra_shell_arg)
|
int call_shell(char_u *cmd, ShellOpts opts, char_u *extra_shell_arg)
|
||||||
{
|
{
|
||||||
int retval;
|
int retval;
|
||||||
|
@ -101,6 +101,8 @@ void shell_free_argv(char **argv)
|
|||||||
/// @param cmd The command to execute, or NULL to run an interactive shell.
|
/// @param cmd The command to execute, or NULL to run an interactive shell.
|
||||||
/// @param opts Options that control how the shell will work.
|
/// @param opts Options that control how the shell will work.
|
||||||
/// @param extra_args Extra arguments to the shell, or NULL.
|
/// @param extra_args Extra arguments to the shell, or NULL.
|
||||||
|
///
|
||||||
|
/// @return shell command exit code
|
||||||
int os_call_shell(char_u *cmd, ShellOpts opts, char_u *extra_args)
|
int os_call_shell(char_u *cmd, ShellOpts opts, char_u *extra_args)
|
||||||
{
|
{
|
||||||
DynamicBuffer input = DYNAMIC_BUFFER_INIT;
|
DynamicBuffer input = DYNAMIC_BUFFER_INIT;
|
||||||
|
Loading…
Reference in New Issue
Block a user