commit 538bd0b2145e1718ae46ccabf8cb5522d403a9a2
parent 2bd8f461812c57facc80a175eafa3e09a5a4e382
Author: phoebos <ben@bvnf.space>
Date: Wed, 18 Dec 2024 11:41:13 +0000
list: check env.sys_db exists before dirent.files
Diffstat:
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/bliss/list.lua b/bliss/list.lua
@@ -2,12 +2,13 @@
-- @module bliss.list
local pkg = require "bliss.pkg"
local dirent = require "posix.dirent"
+local sys_stat = require "posix.sys.stat"
--- The list action.
-- @tparam env env
-- @tparam table arg list of packages to search. If none, list all packages.
local function list(env, arg)
- if #arg == 0 then
+ if #arg == 0 and sys_stat.stat(env.sys_db) then
for file in dirent.files(env.sys_db) do
if string.sub(file, 1, 1) ~= "." then
table.insert(arg, file)