shithub: mc

Download patch

ref: 3450935eec9aa87ac23f8b6524a2c9a873105041
parent: fdf87b91c1bbd64be75b8438ad6eaf492325e5b4
author: sgilles@math.umd.edu <sgilles@math.umd.edu>
date: Fri Oct 18 06:41:59 EDT 2019

Tie return value of mbld to results of specified targets

I'd like to have `mbld test' return non-0 when the tests fail. I think
this does it, but I may be over-simplifying.

 mbld/main.myr | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

Tie return value of mbld to results of specified targets

--- a/mbld/main.myr
+++ b/mbld/main.myr
@@ -15,7 +15,7 @@
 
 const main = {args : byte[:][:]
 	var b, runsrc, objdir, path, cmd
-	var targname, tags, pid, ok, r
+	var targname, tags, pid, ok
 
 	cmd = std.optparse(args, &[
 		.argdesc = "[inputs...]",
@@ -104,15 +104,15 @@
 			ok = bld.buildtarg(b, "all")
 		else
 			match cmd.args[0]
-			| "clean":	r = bld.clean(b)
-			| "install":	r = bld.install(b)
-			| "uninstall":	r = bld.uninstall(b)
-			| "test":	r = bld.test(b, cmd.args[1:])
-			| "bench":	r = bld.bench(b, cmd.args[1:])
-			| "list":	r = show(b, cmd.args[1:])
+			| "clean":	ok = bld.clean(b)
+			| "install":	ok = bld.install(b)
+			| "uninstall":	ok = bld.uninstall(b)
+			| "test":	ok = bld.test(b, cmd.args[1:])
+			| "bench":	ok = bld.bench(b, cmd.args[1:])
+			| "list":	ok = show(b, cmd.args[1:])
 			| _:
 				for target : cmd.args
-					r = ok && bld.buildtarg(b, target)
+					ok = ok && bld.buildtarg(b, target)
 				;;
 			;;
 		;;