From 5b3f52f5fb98cc3af653b043d809254cebe04e6a Mon Sep 17 00:00:00 2001 From: Henrik Lissner Date: Mon, 22 Mar 2021 21:10:34 -0400 Subject: [PATCH] Fix missing doom.error.log and silent straight errors --- core/cli/lib/debugger.el | 20 ++++++++++---------- core/core-cli.el | 1 - 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/core/cli/lib/debugger.el b/core/cli/lib/debugger.el index f638c6507..59e04d98e 100644 --- a/core/cli/lib/debugger.el +++ b/core/cli/lib/debugger.el @@ -5,15 +5,15 @@ (cl-destructuring-bind (backtrace &optional type data . _) (cons (doom-cli--backtrace) data) (with-output-to! doom--cli-log-buffer - (let ((straight-error-p + (let ((straight-error (and (bound-and-true-p straight-process-buffer) + (stringp data) (string-match-p (regexp-quote straight-process-buffer) - (or (get type 'error-message) ""))))) - (cond (straight-error-p - (print! (error "There was an unexpected package error")) - (when-let (output (straight--process-get-output)) - (print-group! - (print! "%s" (string-trim output))))) + data) + (straight--process-get-output)))) + (cond (straight-error + (print! (error "The package manager threw an error")) + (print-group! (print! "%s" (string-trim straight-error)))) ((print! (error "There was an unexpected error")) (print-group! (print! "%s %s" (bold "Message:") (get type 'error-message)) @@ -30,14 +30,14 @@ (with-temp-file doom-cli-log-error-file (insert "# -*- lisp-interaction -*-\n") (insert "# vim: set ft=lisp:\n") - (let ((standard-output doom--cli-log-error-buffer) + (let ((standard-output (current-buffer)) (print-quoted t) (print-escape-newlines t) (print-escape-control-characters t) (print-level nil) (print-circle nil)) - (when straight-error-p - (print (string-trim (or (straight--process-get-output) "")))) + (when straight-error + (print (string-trim straight-error))) (mapc #'print (cons (list type data) backtrace))) (print! (warn "Extended backtrace logged to %s") (relpath doom-cli-log-error-file))))))) diff --git a/core/core-cli.el b/core/core-cli.el index 463df3d30..6df3c366a 100644 --- a/core/core-cli.el +++ b/core/core-cli.el @@ -22,7 +22,6 @@ purpose.") "Where to write the last backtrace to.") (defvar doom--cli-log-buffer (generate-new-buffer " *doom log*")) -(defvar doom--cli-log-error-buffer (generate-new-buffer " *doom error log*")) (defvar doom--cli-commands (make-hash-table :test 'equal)) (defvar doom--cli-groups (make-hash-table :test 'equal)) (defvar doom--cli-group nil)