[Top][All Lists]

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

[elpa] externals/system-packages 4f82d24 092/117: Fix missing space befo

From: Stefan Monnier
Subject: [elpa] externals/system-packages 4f82d24 092/117: Fix missing space before a nonconfirm option
Date: Fri, 14 Dec 2018 17:02:15 -0500 (EST)

branch: externals/system-packages
commit 4f82d2499c9c25029e166ed62724eb18e11a08da
Author: Artyom Khramov <address@hidden>
Commit: Artyom Khramov <address@hidden>

    Fix missing space before a nonconfirm option
    Currently `system-packages-get-command` does not put a space before a
    nonconfirm option and it results in incorrect command, so instead of
    sudo apt-get install rg -y
    We receive
    sudo apt-get install rg-y
    This change adds an additional space before noconfirm option if `PACK`
    parameter was provided.
 system-packages.el           | 6 +++---
 test/system-packages-test.el | 8 +++++++-
 2 files changed, 10 insertions(+), 4 deletions(-)

diff --git a/system-packages.el b/system-packages.el
index 220984f..9312fa5 100644
--- a/system-packages.el
+++ b/system-packages.el
@@ -328,9 +328,9 @@ of passing additional arguments to the package manager."
       (setq command (mapcar (lambda (part) (concat "sudo " part)) command)))
     (setq command (mapconcat 'identity command " && "))
     (setq command (mapconcat 'identity (list command pack) " "))
-    (setq args (concat args noconfirm))
-    (when args
-      (setq command (concat command args)))))
+    (when noconfirm
+      (setq args (concat args (and pack " ") noconfirm)))
+    (concat command args)))
 (defun system-packages--run-command (action &optional pack args)
   "Run a command asynchronously using the system's package manager.
diff --git a/test/system-packages-test.el b/test/system-packages-test.el
index 4360a4a..67b1d7a 100644
--- a/test/system-packages-test.el
+++ b/test/system-packages-test.el
@@ -33,7 +33,13 @@
                  (system-packages-use-sudo t)
                  (system-packages-package-manager 'pacman))
              (system-packages-get-command 'install))
-           "sudo pacman -S --noconfirm")))
+           "sudo pacman -S --noconfirm"))
+  (should (string=
+           (let ((system-packages-noconfirm t)
+                 (system-packages-use-sudo t)
+                 (system-packages-package-manager 'apt))
+             (system-packages-get-command 'install "rg"))
+           "sudo apt-get install rg -y")))
 (ert-deftest system-packages-errors ()
   "Error when we don't know a command."

reply via email to

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