Pārlūkot izejas kodu

bitwarden--raw-runcmd: capture stderr into its own buffer

Previously, warnings and errors would be mixed with json output. This
resulted in json parsing errors which is not what we want. This commit
changes `call-process' to use a temporary buffer for the stderr
messages.
Sean Farley 2 gadi atpakaļ
vecāks
revīzija
072b9e4584
1 mainītis faili ar 12 papildinājumiem un 7 dzēšanām
  1. 12 7
      bitwarden.el

+ 12 - 7
bitwarden.el

@@ -119,13 +119,18 @@ Returns nil if not unlocked."
   "Run bw command CMD with ARGS.
 Returns a list with the first element being the exit code and the
 second element being the output."
-  (with-temp-buffer
-    (list (apply 'call-process
-                 bitwarden-bw-executable
-                 nil (current-buffer) nil
-                 (cons cmd args))
-          (replace-regexp-in-string "\n$" ""
-                                    (buffer-string)))))
+  (let ((stderr (get-buffer-create " *bitwarden-bw-stderr*")))
+    (with-temp-buffer
+      (list (apply 'call-process
+                   bitwarden-bw-executable
+                   nil               ;; input
+                   (list
+                    (current-buffer) ;; stdout
+                    nil)             ;; TODO capture stderr
+                   nil               ;; re-display buffer
+                   (cons cmd args))
+            (replace-regexp-in-string "\n$" ""
+                                      (buffer-string))))))
 
 (defun bitwarden-runcmd (cmd &rest args)
   "Run bw command CMD with ARGS.