Improve filename passing
c9662f1
forgot about internal helpers.
Moreover, it is annoying to see the -- in shell history
for every single external helper call.
This commit is contained in:
parent
6eb216a40a
commit
3607757554
12
sdn.cpp
12
sdn.cpp
|
@ -930,14 +930,16 @@ readfail:
|
||||||
}
|
}
|
||||||
|
|
||||||
fun run_program (initializer_list<const char *> list, const string &filename) {
|
fun run_program (initializer_list<const char *> list, const string &filename) {
|
||||||
|
auto args = (!filename.empty() && filename.front() == '-' ? " -- " : " ")
|
||||||
|
+ shell_escape (filename);
|
||||||
if (g.ext_helpers) {
|
if (g.ext_helpers) {
|
||||||
// XXX: this doesn't try them all out, though it shouldn't make any
|
// XXX: this doesn't try them all out,
|
||||||
// noticeable difference
|
// though it shouldn't make any noticeable difference
|
||||||
const char *found = nullptr;
|
const char *found = nullptr;
|
||||||
for (auto program : list)
|
for (auto program : list)
|
||||||
if ((found = program))
|
if ((found = program))
|
||||||
break;
|
break;
|
||||||
g.ext_helper = found + (" -- " + shell_escape (filename));
|
g.ext_helper.assign (found).append (args);
|
||||||
g.quitting = true;
|
g.quitting = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -953,8 +955,8 @@ fun run_program (initializer_list<const char *> list, const string &filename) {
|
||||||
tcsetpgrp (STDOUT_FILENO, getpgid (0));
|
tcsetpgrp (STDOUT_FILENO, getpgid (0));
|
||||||
|
|
||||||
for (auto program : list)
|
for (auto program : list)
|
||||||
if (program) execl ("/bin/sh", "/bin/sh", "-c", (string (program)
|
if (program) execl ("/bin/sh", "/bin/sh", "-c",
|
||||||
+ " " + shell_escape (filename)).c_str (), NULL);
|
(program + args).c_str (), NULL);
|
||||||
_exit (EXIT_FAILURE);
|
_exit (EXIT_FAILURE);
|
||||||
default:
|
default:
|
||||||
// ...and make sure of it in the parent as well
|
// ...and make sure of it in the parent as well
|
||||||
|
|
Loading…
Reference in New Issue