commit: f420887253711d85af07905e67ef39eee41d386a
parent e7487ef31b5bda6962ee2ce860b6aba78fcbd2fb
Author: Michael Forney <mforney@mforney.org>
Date: Sun, 17 May 2020 01:13:14 -0700
Use assert in a few places
Diffstat:
1 file changed, 3 insertions(+), 7 deletions(-)
diff --git a/setup.lua b/setup.lua
@@ -56,13 +56,9 @@ function gen(dir)
},
perms={},
}
- if not os.execute('mkdir -p '..dir) then
- error('failed to create '..dir)
- end
+ assert(os.execute('mkdir -p '..dir))
local outdir = config.builddir..'/'..dir
- if not os.execute('mkdir -p '..outdir) then
- error('failed to create '..outdir)
- end
+ assert(os.execute('mkdir -p '..outdir))
io.output(dir..'/local.ninja.tmp')
set('gendir', dir)
if dir ~= '.' then
@@ -94,7 +90,7 @@ function gen(dir)
table.sort(pkg.perms, function(s1, s2)
return s1:sub(8) < s2:sub(8)
end)
- local f = io.open(outdir..'/local.perms', 'w')
+ local f = assert(io.open(outdir..'/local.perms', 'w'))
table.insert(pkg.perms, '')
f:write(table.concat(pkg.perms, '\n'))
table.insert(pkg.inputs.perms, '$outdir/local.perms')