소스 검색

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 년 전
부모
커밋
072b9e4584
1개의 변경된 파일12개의 추가작업 그리고 7개의 파일을 삭제
  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.