summaryrefslogtreecommitdiff
path: root/guix/build/utils.scm
diff options
context:
space:
mode:
authorDanny Milosavljevic <dannym@scratchpost.org>2017-06-01 19:04:10 +0200
committerDanny Milosavljevic <dannym@scratchpost.org>2017-06-01 19:06:34 +0200
commit3f65c190d23296e7e718c3deff413e8beb61d8ba (patch)
treed0ab41bdf3a993c27adc62a794ac4c77b11f6465 /guix/build/utils.scm
parent9491227dcbe52fff1b65ebb9b162d825152b7173 (diff)
downloadguix-patches-3f65c190d23296e7e718c3deff413e8beb61d8ba.tar
guix-patches-3f65c190d23296e7e718c3deff413e8beb61d8ba.tar.gz
utils: Add helper for invoking programs.
* guix/build/utils.scm (invoke): New variable. Co-authored-by: Ludovic Courtès <ludo@gnu.org>
Diffstat (limited to 'guix/build/utils.scm')
-rw-r--r--guix/build/utils.scm10
1 files changed, 10 insertions, 0 deletions
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 6d3c29d001..7391307c87 100644
--- a/guix/build/utils.scm
+++ b/guix/build/utils.scm
@@ -84,6 +84,7 @@
fold-port-matches
remove-store-references
wrap-program
+ invoke
locale-category->string))
@@ -579,6 +580,15 @@ Where every <*-phase-name> is an expression evaluating to a symbol, and
((_ phases (add-after old-phase-name new-phase-name new-phase))
(alist-cons-after old-phase-name new-phase-name new-phase phases))))
+(define (invoke program . args)
+ "Invoke PROGRAM with the given ARGS. Raise an error if the exit
+code is non-zero; otherwise return #t."
+ (let ((status (apply system* program args)))
+ (unless (zero? status)
+ (error (format #f "program ~s exited with non-zero code" program)
+ status))
+ #t))
+
;;;
;;; Text substitution (aka. sed).