diff options
author | Přemysl Eric Janouch <p@janouch.name> | 2020-10-08 19:43:19 +0200 |
---|---|---|
committer | Přemysl Eric Janouch <p@janouch.name> | 2020-10-08 19:50:04 +0200 |
commit | 63e7895905a1cc31c5b6881b4738cd04217adbc1 (patch) | |
tree | a912fa86547d733f48bb52bd075bce99aa608c2f | |
parent | 6aa4bd2ff5e70b2067baaed720c9e64b63f62767 (diff) | |
download | sdn-63e7895905a1cc31c5b6881b4738cd04217adbc1.tar.gz sdn-63e7895905a1cc31c5b6881b4738cd04217adbc1.tar.xz sdn-63e7895905a1cc31c5b6881b4738cd04217adbc1.zip |
Let the caller decide how to launch helpers
In the end, we don't need to impose any policy on it,
and it removes a level of quoting, as well as an `eval`.
-rw-r--r-- | README.adoc | 8 | ||||
-rw-r--r-- | sdn.cpp | 3 |
2 files changed, 5 insertions, 6 deletions
diff --git a/README.adoc b/README.adoc index 103078c..de865de 100644 --- a/README.adoc +++ b/README.adoc @@ -64,7 +64,7 @@ sdn-navigate () { # helpers after the terminal has been resized while running sdn command true - eval "exec </dev/tty; $helper" || break + /bin/sh -c "$helper" </dev/tty || break done # ... possibly zle-line-init zle reset-prompt @@ -86,7 +86,7 @@ function sdn-navigate test -z "$cd" || cd "$cd" test -z "$insert" || commandline --insert "$insert " test -z "$helper" && break - eval $helper || break + /bin/sh -c "$helper" || break end commandline --function repaint end @@ -111,7 +111,7 @@ sdn-navigate () { ((SDN_P=SDN_P+${#insert}+1)) } [[ -z "$helper" ]] && break - eval "$helper" || break + /bin/sh -c "$helper" || break done } sdn-restore () { @@ -132,7 +132,7 @@ To start using this navigator, put the following in your 'rc.elv': use str edit:insert:binding[Alt-o] = { local:reesc = [posix]{ str:replace "'\\''" "''" $posix } - local:posix = [cmd]{ eval ($reesc $cmd)" </dev/tty >/dev/tty 2>&1" } + local:posix = [cmd]{ /bin/sh -c $cmd </dev/tty >/dev/tty 2>&1 } # XXX: the -dot is not a stable API, and may hence break soon local:buffer = $edit:current-command @@ -861,8 +861,7 @@ fun run_program (initializer_list<const char*> list, const string &filename) { for (auto program : list) if ((found = program)) break; - g.ext_helper = "/bin/sh -c " + - shell_escape (string (found) + " " + shell_escape (filename)); + g.ext_helper = found + (" " + shell_escape (filename)); g.quitting = true; return; } |