summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès <ludo@gnu.org>2015-11-05 12:04:26 +0100
committerLudovic Courtès <ludo@gnu.org>2015-11-05 12:04:26 +0100
commit650f1615de325f332dbf3d993acc8a16648d795e (patch)
treec3c6222ce9aaa712e98da656c2bf55324f2f84b4
parent67c920fa5d9a77543e0e950fdf26e2f502b656d8 (diff)
downloadguix-650f1615de325f332dbf3d993acc8a16648d795e.tar.gz
edit: Improve error reporting when $EDITOR is not found.
Reported by Benno Evers <benno@bmevers.de>
at <https://lists.gnu.org/archive/html/guix-devel/2015-11/msg00125.html>.

* guix/scripts/edit.scm (guix-edit): Wrap 'execl' call in 'catch'.
  Provide more meaningful error message.
-rw-r--r--guix/scripts/edit.scm11
1 files changed, 9 insertions, 2 deletions
diff --git a/guix/scripts/edit.scm b/guix/scripts/edit.scm
index fa10a16f31..0509148c4d 100644
--- a/guix/scripts/edit.scm
+++ b/guix/scripts/edit.scm
@@ -79,5 +79,12 @@ line."
                     (leave (_ "source location of package '~a' is unknown~%")
                            (package-full-name package))))
                 packages)
-      (apply execlp (%editor) (%editor)
-             (append-map package->location-specification packages)))))
+
+      (catch 'system-error
+        (lambda ()
+          (apply execlp (%editor) (%editor)
+                 (append-map package->location-specification packages)))
+        (lambda args
+          (let ((errno (system-error-errno args)))
+            (leave (_ "failed to launch '~a': ~a~%")
+                   (%editor) (strerror errno))))))))