mirror of
https://github.com/neovim/neovim.git
synced 2025-09-13 14:58:18 +00:00
Rewrite show_shell_mess
as a ShellOpts
flag
This commit is contained in:
@@ -7,13 +7,14 @@
|
|||||||
|
|
||||||
// Flags for mch_call_shell() second argument
|
// Flags for mch_call_shell() second argument
|
||||||
typedef enum {
|
typedef enum {
|
||||||
kShellOptFilter = 1, // filtering text
|
kShellOptFilter = 1, // filtering text
|
||||||
kShellOptExpand = 2, // expanding wildcards
|
kShellOptExpand = 2, // expanding wildcards
|
||||||
kShellOptCooked = 4, // set term to cooked mode
|
kShellOptCooked = 4, // set term to cooked mode
|
||||||
kShellOptDoOut = 8, // redirecting output
|
kShellOptDoOut = 8, // redirecting output
|
||||||
kShellOptSilent = 16, // don't print error returned by command
|
kShellOptSilent = 16, // don't print error returned by command
|
||||||
kShellOptRead = 32, // read lines and insert into buffer
|
kShellOptRead = 32, // read lines and insert into buffer
|
||||||
kShellOptWrite = 64 // write lines from buffer
|
kShellOptWrite = 64, // write lines from buffer
|
||||||
|
kShellOptHideMess = 128, // previously a global variable from os_unix.c
|
||||||
} ShellOpts;
|
} ShellOpts;
|
||||||
|
|
||||||
char ** shell_build_argv(char_u *cmd, char_u *extra_shell_arg);
|
char ** shell_build_argv(char_u *cmd, char_u *extra_shell_arg);
|
||||||
|
@@ -143,7 +143,6 @@ static int save_patterns(int num_pat, char_u **pat, int *num_file,
|
|||||||
|
|
||||||
/* volatile because it is used in signal handler sig_winch(). */
|
/* volatile because it is used in signal handler sig_winch(). */
|
||||||
static volatile int do_resize = FALSE;
|
static volatile int do_resize = FALSE;
|
||||||
static int show_shell_mess = TRUE;
|
|
||||||
/* volatile because it is used in signal handler deathtrap(). */
|
/* volatile because it is used in signal handler deathtrap(). */
|
||||||
static volatile int deadly_signal = 0; /* The signal we caught */
|
static volatile int deadly_signal = 0; /* The signal we caught */
|
||||||
|
|
||||||
@@ -1754,7 +1753,7 @@ int mch_call_shell(char_u *cmd, ShellOpts opts, char_u *extra_shell_arg)
|
|||||||
} else if (pid == 0) { /* child */
|
} else if (pid == 0) { /* child */
|
||||||
reset_signals(); /* handle signals normally */
|
reset_signals(); /* handle signals normally */
|
||||||
|
|
||||||
if (!show_shell_mess || (opts & kShellOptExpand)) {
|
if (opts & (kShellOptHideMess | kShellOptExpand)) {
|
||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -2459,6 +2458,7 @@ int flags; /* EW_* flags */
|
|||||||
char_u *p;
|
char_u *p;
|
||||||
int dir;
|
int dir;
|
||||||
char_u *extra_shell_arg = NULL;
|
char_u *extra_shell_arg = NULL;
|
||||||
|
ShellOpts shellopts = kShellOptExpand | kShellOptSilent;
|
||||||
/*
|
/*
|
||||||
* This is the non-OS/2 implementation (really Unix).
|
* This is the non-OS/2 implementation (really Unix).
|
||||||
*/
|
*/
|
||||||
@@ -2635,8 +2635,11 @@ int flags; /* EW_* flags */
|
|||||||
}
|
}
|
||||||
*p = NUL;
|
*p = NUL;
|
||||||
}
|
}
|
||||||
if (flags & EW_SILENT)
|
|
||||||
show_shell_mess = FALSE;
|
if (flags & EW_SILENT) {
|
||||||
|
shellopts |= kShellOptHideMess;
|
||||||
|
}
|
||||||
|
|
||||||
if (ampersent)
|
if (ampersent)
|
||||||
STRCAT(command, "&"); /* put the '&' after the redirection */
|
STRCAT(command, "&"); /* put the '&' after the redirection */
|
||||||
|
|
||||||
@@ -2661,7 +2664,7 @@ int flags; /* EW_* flags */
|
|||||||
*/
|
*/
|
||||||
i = call_shell(
|
i = call_shell(
|
||||||
command,
|
command,
|
||||||
kShellOptExpand | kShellOptSilent,
|
shellopts,
|
||||||
extra_shell_arg
|
extra_shell_arg
|
||||||
);
|
);
|
||||||
|
|
||||||
@@ -2670,7 +2673,6 @@ int flags; /* EW_* flags */
|
|||||||
if (ampersent)
|
if (ampersent)
|
||||||
os_delay(10L, TRUE);
|
os_delay(10L, TRUE);
|
||||||
|
|
||||||
show_shell_mess = TRUE;
|
|
||||||
vim_free(command);
|
vim_free(command);
|
||||||
|
|
||||||
if (i != 0) { /* mch_call_shell() failed */
|
if (i != 0) { /* mch_call_shell() failed */
|
||||||
|
Reference in New Issue
Block a user