diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2024-04-17 02:00:10 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2024-04-17 02:00:10 +0200 |
commit | 360775755401340f7e2b41cdc8d1fc9fd1d16feb (patch) | |
tree | f0f61b73364c3d392dbe06d18dd6f5c520ae6cfb /sdn.cpp | |
parent | 6eb216a40a3f523c560a13df6c617d50a5e3dcdf (diff) | |
download | sdn-360775755401340f7e2b41cdc8d1fc9fd1d16feb.tar.gz sdn-360775755401340f7e2b41cdc8d1fc9fd1d16feb.tar.xz sdn-360775755401340f7e2b41cdc8d1fc9fd1d16feb.zip |
Improve filename passing
c9662f1 forgot about internal helpers.
Moreover, it is annoying to see the -- in shell history
for every single external helper call.
Diffstat (limited to 'sdn.cpp')
-rw-r--r-- | sdn.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
@@ -930,14 +930,16 @@ readfail: } fun run_program (initializer_list<const char *> list, const string &filename) { + auto args = (!filename.empty() && filename.front() == '-' ? " -- " : " ") + + shell_escape (filename); if (g.ext_helpers) { - // XXX: this doesn't try them all out, though it shouldn't make any - // noticeable difference + // XXX: this doesn't try them all out, + // though it shouldn't make any noticeable difference const char *found = nullptr; for (auto program : list) if ((found = program)) break; - g.ext_helper = found + (" -- " + shell_escape (filename)); + g.ext_helper.assign (found).append (args); g.quitting = true; return; } @@ -953,8 +955,8 @@ fun run_program (initializer_list<const char *> list, const string &filename) { tcsetpgrp (STDOUT_FILENO, getpgid (0)); for (auto program : list) - if (program) execl ("/bin/sh", "/bin/sh", "-c", (string (program) - + " " + shell_escape (filename)).c_str (), NULL); + if (program) execl ("/bin/sh", "/bin/sh", "-c", + (program + args).c_str (), NULL); _exit (EXIT_FAILURE); default: // ...and make sure of it in the parent as well |