From cec661b7d0e6d0eda31a97b5621d361ae5c71de3 Mon Sep 17 00:00:00 2001 From: Jordan Brown Date: Wed, 21 Sep 2016 10:07:21 -0400 Subject: Use (car (process-lines ...)) instead of (shell-command ...) `shell-command` assumes Bourne-shell-compatible quoting, which doesn't work when the user isn't using a Bourne-compatible shell. Instead of futzing about with quoting, we can just use `process-lines` to execute a process and pass it arguments directly. --- elisp/geiser-chez.el | 4 +--- elisp/geiser-chibi.el | 7 +++---- elisp/geiser-chicken.el | 5 +---- elisp/geiser-guile.el | 5 +---- elisp/geiser-mit.el | 10 ++++++---- elisp/geiser-racket.el | 5 +---- 6 files changed, 13 insertions(+), 23 deletions(-) diff --git a/elisp/geiser-chez.el b/elisp/geiser-chez.el index 1793cfd..17b6c8d 100644 --- a/elisp/geiser-chez.el +++ b/elisp/geiser-chez.el @@ -96,9 +96,7 @@ This function uses `geiser-chez-init-file' if it exists." (defconst geiser-chez-minimum-version "9.4") (defun geiser-chez--version (binary) - (shell-command-to-string - (format "%s --version" - (shell-quote-argument binary)))) + (car (process-lines binary "--version"))) (defun geiser-chez--startup (remote) (let ((geiser-log-verbose-p t)) diff --git a/elisp/geiser-chibi.el b/elisp/geiser-chibi.el index cb2577e..acb8b61 100644 --- a/elisp/geiser-chibi.el +++ b/elisp/geiser-chibi.el @@ -97,10 +97,9 @@ This function uses `geiser-chibi-init-file' if it exists." (defconst geiser-chibi-minimum-version "0.7.3") (defun geiser-chibi--version (binary) - (second (split-string (shell-command-to-string - (format "%s -V" - (shell-quote-argument binary))) - " "))) + (second (split-string + (car (process-lines binary "-V")) + " "))) (defun geiser-chibi--startup (remote) (let ((geiser-log-verbose-p t)) diff --git a/elisp/geiser-chicken.el b/elisp/geiser-chicken.el index 8c10908..60567b7 100644 --- a/elisp/geiser-chicken.el +++ b/elisp/geiser-chicken.el @@ -263,10 +263,7 @@ 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 %s" - (shell-quote-argument binary) - (shell-quote-argument "(display (chicken-version))")))) + (car (process-lines binary "-e" "(display (chicken-version))"))) (defun connect-to-chicken () "Start a Chicken REPL connected to a remote process." diff --git a/elisp/geiser-guile.el b/elisp/geiser-guile.el index de2e23f..dacca55 100644 --- a/elisp/geiser-guile.el +++ b/elisp/geiser-guile.el @@ -334,10 +334,7 @@ This function uses `geiser-guile-init-file' if it exists." (defconst geiser-guile-minimum-version "2.0") (defun geiser-guile--version (binary) - (shell-command-to-string - (format "%s -c %s" - (shell-quote-argument binary) - (shell-quote-argument "(display (version))")))) + (car (process-lines binary "-c" "(display (version))"))) (defun geiser-guile-update-warning-level () "Update the warning level used by the REPL. diff --git a/elisp/geiser-mit.el b/elisp/geiser-mit.el index 5e61cf1..fffcfb6 100644 --- a/elisp/geiser-mit.el +++ b/elisp/geiser-mit.el @@ -120,10 +120,12 @@ This function uses `geiser-mit-init-file' if it exists." (defconst geiser-mit-minimum-version "9.1.1") (defun geiser-mit--version (binary) - (shell-command-to-string - (format "%s --quiet --no-init-file --eval %s" - (shell-quote-argument binary) - "'(begin (display (get-subsystem-version-string \"Release\")) (%exit 0))'"))) + (car (process-lines binary + "--quiet" + "--no-init-file" + "--eval" + "(begin (display (get-subsystem-version-string \"Release\")) + (%exit 0))"))) (defconst geiser-mit--path-rx "^In \\([^:\n ]+\\):\n") (defun geiser-mit--startup (remote) diff --git a/elisp/geiser-racket.el b/elisp/geiser-racket.el index ac7626a..c51b08c 100644 --- a/elisp/geiser-racket.el +++ b/elisp/geiser-racket.el @@ -363,10 +363,7 @@ using start-geiser, a procedure in the geiser/server module." (defvar geiser-racket-minimum-version "5.3") (defun geiser-racket--version (binary) - (shell-command-to-string - (format "%s -e %s" - (shell-quote-argument binary) - (shell-quote-argument "(display (version))")))) + (car (process-lines binary "-e" "(display (version))"))) (defvar geiser-racket--image-cache-dir nil) -- cgit v1.2.3