[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
01/01: utils: Add helper for invoking programs.
From: |
Danny Milosavljevic |
Subject: |
01/01: utils: Add helper for invoking programs. |
Date: |
Thu, 1 Jun 2017 13:08:08 -0400 (EDT) |
dannym pushed a commit to branch core-updates
in repository guix.
commit 3f65c190d23296e7e718c3deff413e8beb61d8ba
Author: Danny Milosavljevic <address@hidden>
Date: Thu Jun 1 19:04:10 2017 +0200
utils: Add helper for invoking programs.
* guix/build/utils.scm (invoke): New variable.
Co-authored-by: Ludovic Courtès <address@hidden>
---
guix/build/utils.scm | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/guix/build/utils.scm b/guix/build/utils.scm
index 6d3c29d..7391307 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).