Jelajahi Sumber

Fixing warning and logging

bodicsek 2 tahun lalu
induk
melakukan
e28f430f68
1 mengubah file dengan 13 tambahan dan 14 penghapusan
  1. 13 14
      bitwarden.el

+ 13 - 14
bitwarden.el

@@ -119,18 +119,17 @@ 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."
-  (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))))))
+  (with-temp-buffer
+    (list (apply 'call-process
+                 bitwarden-bw-executable
+                 nil               ;; input
+                 (list
+                  (current-buffer) ;; stdout
+                  nil)             ;; TODO capture stderr - nil, t (mixing with stdout) or file name string
+                 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.
@@ -378,11 +377,11 @@ Returns a vector of hashtables of the results."
              (json (json-read-from-string result)))
         json))))
 
-(defun bitwarden-sync ()
+(defun bitwarden-sync (&optional print-message)
   "Sync local store with server."
   (interactive)
   (let ((res (bitwarden--auto-cmd (list "sync"))))
-    (message (nth 1 res))))
+    (bitwarden--message (nth 1 res) nil print-message)))
 
 ;================================= auth-source =================================