commit c94f6c22bfba71fcc03850945b8d4970e86492f5
parent 4c9f07d2063becda9ce6e71821b6b105ff065236
Author: phoebos <ben@bvnf.space>
Date: Tue, 18 Jul 2023 14:42:21 +0100
add utils.run_quiet
Diffstat:
2 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/bliss/install.lua b/bliss/install.lua
@@ -50,7 +50,7 @@ local function install(env, arg)
for k,v in ipairs(tar_manifest) do tar_manifest[k] = v[1] end
table.sort(tar_manifest)
- -- TODO: diff manifests, remove old files, verify new files
+ -- TODO: diff manifests, remove old files, verify new files
-- PWD must contain the files
for _, file in ipairs(tar_manifest) do
@@ -73,12 +73,12 @@ local function install(env, arg)
local dirname = libgen.dirname(_file)
local sb = sys_stat.stat(_file)
if sb and sys_stat.S_ISLNK(sb.st_mode) ~= 0 then
- if not utils.run("cp", {"-fP", "./"..file, dirname .. "/."}) then os.exit(false) end
+ if not utils.run_quiet("cp", {"-fP", "./"..file, dirname .. "/."}) then os.exit(false) end
else
local _tmp_file = dirname.."/__bliss-tmp-"..pkgname.."-"..libgen.basename(file).."-"..env.PID
- if not utils.run("cp", {"-fP", "./"..file, _tmp_file}) or
- not utils.run("mv", {"-f", _tmp_file, _file}) then
+ if not utils.run_quiet("cp", {"-fP", "./"..file, _tmp_file}) or
+ not utils.run_quiet("mv", {"-f", _tmp_file, _file}) then
-- run pkg_clean
getmetatable(env.atexit).__gc()
diff --git a/bliss/utils.lua b/bliss/utils.lua
@@ -8,7 +8,7 @@ local stdlib = require "posix.stdlib"
local signal = require "posix.signal"
local colors = {"", "", ""}
-local setup, setup_colors, check_execute, get_available, get_pkg_clean, trap_on, trap_off, split, mkdirp, mkcd, rm_rf, log, warn, die, prompt, run_shell, run, capture, shallowcopy, am_not_owner, as_user
+local setup, setup_colors, check_execute, get_available, get_pkg_clean, trap_on, trap_off, split, mkdirp, mkcd, rm_rf, log, warn, die, prompt, run_shell, run, run_quiet, capture, shallowcopy, am_not_owner, as_user
function setup()
colors = setup_colors()
@@ -210,7 +210,9 @@ end
-- If logfile is provided, the output of cmd is copied to a file of that name.
function run(path, cmd, env, logfile)
io.stderr:write(path .. " " .. table.concat(cmd, " ", 1) .. "\n")
-
+ return run_quiet(path, cmd, env, logfile)
+end
+function run_quiet(path, cmd, env, logfile)
local f,r,w
if logfile then
local err
@@ -305,7 +307,7 @@ function as_user(env, user, arg)
flags = {"-u", user, "--", table.unpack(arg)}
end
- run(env.SU, flags)
+ run_quiet(env.SU, flags)
end
local M = {
@@ -322,6 +324,7 @@ local M = {
prompt = prompt,
run_shell = run_shell,
run = run,
+ run_quiet = run_quiet,
capture = capture,
shallowcopy = shallowcopy,
am_not_owner= am_not_owner,