From d0b64860e1f676764ece87c3b31fed5b706e52e5 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Thu, 23 Mar 2017 02:13:11 -0400 Subject: [PATCH] Fix doom-sh/doom-sudo + bootstraps --- core/autoload/system.el | 14 +++++++++----- core/core-lib.el | 1 - 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/core/autoload/system.el b/core/autoload/system.el index ddaa87e15..827a89a19 100644 --- a/core/autoload/system.el +++ b/core/autoload/system.el @@ -21,10 +21,14 @@ (defun doom-sh (command &rest args) "Runs a shell command and prints any output to the DOOM buffer." (let ((cmd-list (split-string command " "))) - (if (equal (car cmd-list) "sudo") - (apply 'doom-sudo (string-join (cdr command) " ") args) - (let ((buf (get-buffer-create "*doom-sh*"))) - (shell-command (apply 'format command args) buf))))) + (cond ((equal (car cmd-list) "sudo") + (apply 'doom-sudo (string-join (cdr cmd-list) " ") args)) + ((let ((bin (executable-find "npm"))) + (and (file-exists-p bin) + (not (file-writable-p bin)))) + (apply 'doom-sudo (string-join cmd-list " ") args)) + (t + (princ (shell-command-to-string (apply 'format command args))))))) ;;;###autoload (defun doom-sudo (command &rest args) @@ -33,7 +37,7 @@ (with-current-buffer (get-buffer-create "*doom-sudo*") (unless (string-prefix-p "/sudo::/" default-directory) (cd "/sudo::/")) - (apply 'doom-sh command args)))) + (princ (shell-command-to-string (apply 'format command args)))))) ;;;###autoload (defun doom-fetch (fetcher location dest) diff --git a/core/core-lib.el b/core/core-lib.el index 8c15b853f..e05370ade 100644 --- a/core/core-lib.el +++ b/core/core-lib.el @@ -243,7 +243,6 @@ executed when called with `set!'. FORMS are not evaluated until `set!' calls it. `(push (cons ',name (lambda () (cl-flet ((sh (lambda (&rest args) (apply 'doom-sh args))) - (sh& (lambda (&rest args) (apply 'doom-async-sh args))) (sudo (lambda (&rest args) (apply 'doom-sudo args))) (fetch (lambda (&rest args) (apply 'doom-fetch args))) (message (lambda (&rest args)