mirror of
https://github.com/MidnightCommander/mc
synced 2025-03-04 07:01:30 +03:00
Ticket #3646: Filtered View doesn't work.
The bug: 1. Go to the source directory for version 4.8.17. 2. Enter the command "ls -l misc/mc*". The output will show at least 7 files. 3. Start mc. 4. Press Meta-! to open the "Filtered View" dialogue box. 5. Enter the same command: "ls -l misc/mc*". Result: MC displays the following error: "ls: cannot access misc/mc*: No such file or directory". Fix: (mc_popen): use popen(3) way: pass command to /bin/sh using the -c flag. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
35ad1ab0b2
commit
44859027b4
@ -510,7 +510,7 @@ mc_pipe_t *
|
||||
mc_popen (const char *command, GError ** error)
|
||||
{
|
||||
mc_pipe_t *p;
|
||||
char **argv;
|
||||
const char *const argv[] = { "/bin/sh", "sh", "-c", command, "\0" };
|
||||
|
||||
p = g_try_new (mc_pipe_t, 1);
|
||||
if (p == NULL)
|
||||
@ -520,24 +520,15 @@ mc_popen (const char *command, GError ** error)
|
||||
goto ret_err;
|
||||
}
|
||||
|
||||
if (!g_shell_parse_argv (command, NULL, &argv, error))
|
||||
{
|
||||
mc_replace_error (error, MC_PIPE_ERROR_PARSE_COMMAND, "%s",
|
||||
_("Cannot parse command for pipe"));
|
||||
goto ret_err;
|
||||
}
|
||||
|
||||
if (!g_spawn_async_with_pipes
|
||||
(NULL, argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_SEARCH_PATH, NULL, NULL,
|
||||
&p->child_pid, NULL, &p->out.fd, &p->err.fd, error))
|
||||
(NULL, (gchar **) argv, NULL, G_SPAWN_DO_NOT_REAP_CHILD | G_SPAWN_FILE_AND_ARGV_ZERO,
|
||||
NULL, NULL, &p->child_pid, NULL, &p->out.fd, &p->err.fd, error))
|
||||
{
|
||||
mc_replace_error (error, MC_PIPE_ERROR_CREATE_PIPE_STREAM, "%s",
|
||||
_("Cannot create pipe streams"));
|
||||
goto ret_err;
|
||||
}
|
||||
|
||||
g_strfreev (argv);
|
||||
|
||||
p->out.buf[0] = '\0';
|
||||
p->out.len = MC_PIPE_BUFSIZE;
|
||||
p->out.null_term = FALSE;
|
||||
|
Loading…
x
Reference in New Issue
Block a user