emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[nongnu] elpa/geiser-chicken 1854a39 086/102: geiser-chicken--version: D


From: Philip Kaludercic
Subject: [nongnu] elpa/geiser-chicken 1854a39 086/102: geiser-chicken--version: Don't use a shell
Date: Sun, 1 Aug 2021 18:27:01 -0400 (EDT)

branch: elpa/geiser-chicken
commit 1854a3986a6d651b580463e3c071f8976e95aec2
Author: Noam Postavsky <npostavs@users.sourceforge.net>
Commit: Noam Postavsky <npostavs@users.sourceforge.net>

    geiser-chicken--version: Don't use a shell
    
    Using shell-command-to-string requires making assumptions about how
    quoting works in the shell.  While single quotes are okay for bourne
    shells, it doesn't work for cmd.exe (the default on Windows).
    
    Use call-process instead to remove dependency on shell quoting
    details.
---
 elisp/geiser-chicken.el | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/elisp/geiser-chicken.el b/elisp/geiser-chicken.el
index 170858a..251bce8 100644
--- a/elisp/geiser-chicken.el
+++ b/elisp/geiser-chicken.el
@@ -260,14 +260,17 @@ This function uses `geiser-chicken-init-file' if it 
exists."
 (defconst geiser-chicken-minimum-version "4.8.0.0")
 
 (defun geiser-chicken--version (binary)
-  (shell-command-to-string
-   (format "%s -e '(display \
+  (cl-destructuring-bind (program . args)
+      (append (if (listp binary) binary (list binary))
+              '("-e" "(display \
                      (or (handle-exceptions exn \
                            #f \
                            (eval `(begin (import chicken.platform) \
                                          (chicken-version)))) \
-                         (chicken-version)))'"
-           (if (listp binary) (car binary) binary))))
+                         (chicken-version)))"))
+    (with-temp-buffer
+      (apply #'call-process program nil '(t t) t args)
+      (buffer-string))))
 
 (defun connect-to-chicken ()
   "Start a Chicken REPL connected to a remote process."



reply via email to

[Prev in Thread] Current Thread [Next in Thread]