From d9739a2d109e0fd42fe8baf27e43d67ac8c19ff3 Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Tue, 11 Aug 2020 14:26:49 -0400 Subject: [PATCH] Fix #3727: 'doom: command not found' error on 'doom upgrade' --- bin/doom | 2 +- core/core-cli.el | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/bin/doom b/bin/doom index 416005e75..3a9907e99 100755 --- a/bin/doom +++ b/bin/doom @@ -7,7 +7,7 @@ :; _DOOMPOST="$_DOOMBASE/.local/.doom.sh" :; $EMACS --no-site-file --script "$0" -- "$@" :; CODE=$? -:; [ -x "$_DOOMPOST" ] && PATH="$_DOOMBASE/bin:$PATH" "$_DOOMPOST" "$0" "$@" +:; [ -x "$_DOOMPOST" ] && "$_DOOMPOST" "$0" "$@" :; exit $CODE ;; CLI ops tend to eat a lot of memory. To speed it up, stave off the GC, but diff --git a/core/core-cli.el b/core/core-cli.el index 6bc74268f..c4dba62c0 100644 --- a/core/core-cli.el +++ b/core/core-cli.el @@ -177,10 +177,11 @@ COMMAND, and passes ARGS to it." (insert "#!/usr/bin/env sh\n" (save-match-data (cl-loop for env in process-environment - if (string-match "^\\([^ !@#$%^&*()=]+\\)=\\(.+\\)$" env) - concat (format "%s=%S\n" + if (string-match "^\\([a-zA-Z0-9_]+\\)=\\(.+\\)$" env) + concat (format "export %s=%S\n" (match-string 1 env) (match-string 2 env)))) + (format "\nexport PATH=\"%s:$PATH\"\n" (concat doom-emacs-dir "bin/")) "\n[ -x \"$0\" ] && rm -f \"$0\"\n" (if (stringp lines) lines