run-command: convert simple callsites to use_shell
Now that we have the use_shell feature, these callsites can all be converted with small changes. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
fa7151a61e
commit
ac0ba18df0
@ -249,10 +249,11 @@ static int filter_buffer(int fd, void *data)
|
|||||||
struct child_process child_process;
|
struct child_process child_process;
|
||||||
struct filter_params *params = (struct filter_params *)data;
|
struct filter_params *params = (struct filter_params *)data;
|
||||||
int write_err, status;
|
int write_err, status;
|
||||||
const char *argv[] = { "sh", "-c", params->cmd, NULL };
|
const char *argv[] = { params->cmd, NULL };
|
||||||
|
|
||||||
memset(&child_process, 0, sizeof(child_process));
|
memset(&child_process, 0, sizeof(child_process));
|
||||||
child_process.argv = argv;
|
child_process.argv = argv;
|
||||||
|
child_process.use_shell = 1;
|
||||||
child_process.in = -1;
|
child_process.in = -1;
|
||||||
child_process.out = fd;
|
child_process.out = fd;
|
||||||
|
|
||||||
|
@ -965,17 +965,13 @@ static struct store *imap_open_store(struct imap_server_conf *srvc)
|
|||||||
/* open connection to IMAP server */
|
/* open connection to IMAP server */
|
||||||
|
|
||||||
if (srvc->tunnel) {
|
if (srvc->tunnel) {
|
||||||
const char *argv[4];
|
const char *argv[] = { srvc->tunnel, NULL };
|
||||||
struct child_process tunnel = {0};
|
struct child_process tunnel = {0};
|
||||||
|
|
||||||
imap_info("Starting tunnel '%s'... ", srvc->tunnel);
|
imap_info("Starting tunnel '%s'... ", srvc->tunnel);
|
||||||
|
|
||||||
argv[0] = "sh";
|
|
||||||
argv[1] = "-c";
|
|
||||||
argv[2] = srvc->tunnel;
|
|
||||||
argv[3] = NULL;
|
|
||||||
|
|
||||||
tunnel.argv = argv;
|
tunnel.argv = argv;
|
||||||
|
tunnel.use_shell = 1;
|
||||||
tunnel.in = -1;
|
tunnel.in = -1;
|
||||||
tunnel.out = -1;
|
tunnel.out = -1;
|
||||||
if (start_command(&tunnel))
|
if (start_command(&tunnel))
|
||||||
|
@ -175,7 +175,7 @@ static int ll_ext_merge(const struct ll_merge_driver *fn,
|
|||||||
{ "B", temp[2] },
|
{ "B", temp[2] },
|
||||||
{ NULL }
|
{ NULL }
|
||||||
};
|
};
|
||||||
const char *args[] = { "sh", "-c", NULL, NULL };
|
const char *args[] = { NULL, NULL };
|
||||||
int status, fd, i;
|
int status, fd, i;
|
||||||
struct stat st;
|
struct stat st;
|
||||||
|
|
||||||
@ -190,8 +190,8 @@ static int ll_ext_merge(const struct ll_merge_driver *fn,
|
|||||||
|
|
||||||
strbuf_expand(&cmd, fn->cmdline, strbuf_expand_dict_cb, &dict);
|
strbuf_expand(&cmd, fn->cmdline, strbuf_expand_dict_cb, &dict);
|
||||||
|
|
||||||
args[2] = cmd.buf;
|
args[0] = cmd.buf;
|
||||||
status = run_command_v_opt(args, 0);
|
status = run_command_v_opt(args, RUN_USING_SHELL);
|
||||||
fd = open(temp[1], O_RDONLY);
|
fd = open(temp[1], O_RDONLY);
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
goto bad;
|
goto bad;
|
||||||
|
5
pager.c
5
pager.c
@ -28,7 +28,7 @@ static void pager_preexec(void)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static const char *pager_argv[] = { "sh", "-c", NULL, NULL };
|
static const char *pager_argv[] = { NULL, NULL };
|
||||||
static struct child_process pager_process;
|
static struct child_process pager_process;
|
||||||
|
|
||||||
static void wait_for_pager(void)
|
static void wait_for_pager(void)
|
||||||
@ -81,7 +81,8 @@ void setup_pager(void)
|
|||||||
spawned_pager = 1; /* means we are emitting to terminal */
|
spawned_pager = 1; /* means we are emitting to terminal */
|
||||||
|
|
||||||
/* spawn the pager */
|
/* spawn the pager */
|
||||||
pager_argv[2] = pager;
|
pager_argv[0] = pager;
|
||||||
|
pager_process.use_shell = 1;
|
||||||
pager_process.argv = pager_argv;
|
pager_process.argv = pager_argv;
|
||||||
pager_process.in = -1;
|
pager_process.in = -1;
|
||||||
if (!getenv("LESS")) {
|
if (!getenv("LESS")) {
|
||||||
|
Loading…
Reference in New Issue
Block a user