[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Why should build phases not return unspecified values?
From: |
Danny Milosavljevic |
Subject: |
Re: Why should build phases not return unspecified values? |
Date: |
Wed, 20 Dec 2017 03:15:36 +0100 |
Hi Mark,
I agree that exceptions are the way to go here.
Btw, Ludo and I put "invoke" into ./guix/build/utils.scm somewhen in June (now
in master).
(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))
So we could actually use "invoke" in phases where we use "system*" now.
There are 1331 lines with "system*" in gnu/packages - that would take some time
to port. Or we could substitute (zero? (system* ...)) by (invoke ...) with the
editor - I don't see much risk with doing the latter, in core-updates-next or
something.
In the far future, phase API could change to not examine the result of a phase
and "invoke" would still work fine.