emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/dired-git-info cfa7d69 2/5: Ignore output of failed com


From: Clemens Radermacher
Subject: [elpa] externals/dired-git-info cfa7d69 2/5: Ignore output of failed commands
Date: Thu, 21 Feb 2019 10:55:55 -0500 (EST)

branch: externals/dired-git-info
commit cfa7d69d8c8d5f1d02d5313428791e90d22f8190
Author: Clemens Radermacher <address@hidden>
Commit: Clemens Radermacher <address@hidden>

    Ignore output of failed commands
---
 dired-git-info.el | 13 +++++++++----
 1 file changed, 9 insertions(+), 4 deletions(-)

diff --git a/dired-git-info.el b/dired-git-info.el
index 2ad24c7..9c5ba21 100644
--- a/dired-git-info.el
+++ b/dired-git-info.el
@@ -85,10 +85,15 @@ are (see git-log PRETTY FORMATS for all):
   "If no details view has to be restored.")
 
 (defun dgi--command-to-string (program &rest args)
-  "Execute PROGRAM with arguments ARGS and return output string."
-  (with-output-to-string
-    (with-current-buffer standard-output
-      (apply #'process-file program nil t nil args))))
+  "Execute PROGRAM with arguments ARGS and return output string.
+
+If program returns non zero exit code return nil."
+  (let* ((ecode nil)
+         (output (with-output-to-string
+                    (with-current-buffer standard-output
+                      (setq ecode (apply #'process-file program nil t nil 
args))))))
+    (when (eq ecode 0)
+      output)))
 
 
 (defun dgi--get-commit-info (&optional file gitf)



reply via email to

[Prev in Thread] Current Thread [Next in Thread]