[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[nongnu] elpa/exec-path-from-shell 2ae5088c21 015/114: Use printf instea
From: |
ELPA Syncer |
Subject: |
[nongnu] elpa/exec-path-from-shell 2ae5088c21 015/114: Use printf instead of echo (thanks @bradleywright) |
Date: |
Tue, 5 Sep 2023 03:59:57 -0400 (EDT) |
branch: elpa/exec-path-from-shell
commit 2ae5088c2129c19be817f6ed894d218ca67d4ede
Author: Steve Purcell <steve@sanityinc.com>
Commit: Steve Purcell <steve@sanityinc.com>
Use printf instead of echo (thanks @bradleywright)
---
exec-path-from-shell.el | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/exec-path-from-shell.el b/exec-path-from-shell.el
index 21e1c83a67..f17c566978 100644
--- a/exec-path-from-shell.el
+++ b/exec-path-from-shell.el
@@ -66,14 +66,17 @@
"List of environment variables which are copied from the shell."
:group 'exec-path-from-shell)
-(defun exec-path-from-shell-echo (str)
- "Return the result of echoing STR in the user's shell.
+(defun exec-path-from-shell-printf (str)
+ "Return the result of printing STR in the user's shell.
-STR is inserted literally in a double-quoted argument to echo.
-Executes $SHELL as interactive login shell."
+Executes $SHELL as interactive login shell.
+
+STR is inserted literally in a double-quoted argument to printf,
+and may therefore contain backslashed escape sequences, but must not
+contain the '%' character."
(with-temp-buffer
(call-process (getenv "SHELL") nil (current-buffer) nil
- "--login" "-i" "-c" (concat "echo -e \"__RESULT\\0" str
"\""))
+ "--login" "-i" "-c" (concat "printf \"__RESULT\\0" str "\""))
(goto-char (point-min))
(when (re-search-forward "__RESULT\0\\(.*\\)" nil t)
(match-string 1))))
@@ -85,7 +88,7 @@ Execute $SHELL as interactive login shell. The result is a
list
of (NAME . VALUE) pairs."
(let ((values
(split-string
- (exec-path-from-shell-echo
+ (exec-path-from-shell-printf
(mapconcat (lambda (n) (concat "$" n)) names "\\0"))
"\0"))
result)
- [nongnu] branch elpa/exec-path-from-shell created (now 03fc0a38af), ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell fead3d5360 002/114: Add autoload cookies, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 96ef5e6093 008/114: Add a readme, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 0b59ea733b 012/114: Also set eshell-path-env when setting exec-path from $PATH, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 148145ff45 014/114: Force use of -e with built-in echo, which is not default in bash, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 4223b12cf9 004/114: Extract PATH via marker, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 2ae5088c21 015/114: Use printf instead of echo (thanks @bradleywright),
ELPA Syncer <=
- [nongnu] elpa/exec-path-from-shell de589a96ba 017/114: Use parse-colon-path to split $PATH, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 183385ab94 016/114: Set checkdoc-minor-mode in local vars without using exec, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 8ec1a90951 019/114: Fully escape interspersed null characters too (see #5), ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell f8e39d754c 023/114: Tidier code for double-quoting printf args, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 54f272f46e 024/114: Better docstrings, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell ab268a035a 026/114: Use the system-wide printf binary (if available) instead of shell built-in, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 1e51ae1f97 027/114: With tcsh, examine each variable with a separate shell invocation, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 3ff20e8d60 028/114: Update copyright year, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 49219e9425 029/114: Append exec-directory to exec-path, as is conventional, ELPA Syncer, 2023/09/05
- [nongnu] elpa/exec-path-from-shell 247683134a 035/114: Include shell output in debug messages, ELPA Syncer, 2023/09/05