Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/distrib/sets when formatting a file list, exit on errors



details:   https://anonhg.NetBSD.org/src/rev/172de893c068
branches:  trunk
changeset: 941977:172de893c068
user:      rillig <rillig%NetBSD.org@localhost>
date:      Mon Nov 02 20:14:01 2020 +0000

description:
when formatting a file list, exit on errors

This is needed to regenerate distrib/sets/lists/tests/mi for adding
another test in usr.bin/make.

diffstat:

 distrib/sets/fmt-list |  13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diffs (45 lines):

diff -r fbb4ec40941e -r 172de893c068 distrib/sets/fmt-list
--- a/distrib/sets/fmt-list     Mon Nov 02 19:07:09 2020 +0000
+++ b/distrib/sets/fmt-list     Mon Nov 02 20:14:01 2020 +0000
@@ -1,5 +1,5 @@
 #! /usr/bin/lua
--- $NetBSD: fmt-list,v 1.2 2020/09/08 19:11:30 rillig Exp $
+-- $NetBSD: fmt-list,v 1.3 2020/11/02 20:14:01 rillig Exp $
 
 --[[
 
@@ -411,7 +411,7 @@
     for _, err in ipairs(errors) do
       print(err)
     end
-    return
+    return false
   end
 
   normalize(entries)
@@ -419,18 +419,23 @@
   if write_back then
     write_list(fname, head, entries)
   end
+  return true
 end
 
 
 local function main(arg)
+  local seen_error = false
   local write_back = true
   for _, fname in ipairs(arg) do
     if fname == "-n" then
       write_back = false
     else
-      format_list(fname, write_back)
+      if not format_list(fname, write_back) then
+        seen_error = true
+      end
     end
   end
+  return not seen_error
 end
 
-main(arg)
+os.exit(main(arg))



Home | Main Index | Thread Index | Old Index