aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorsinanmohd <sinan@sinanmohd.com>2023-10-02 11:33:30 +0530
committersinanmohd <sinan@sinanmohd.com>2023-10-02 11:33:30 +0530
commit8f0e30c4a23de4757232ec168c100f5fd1d302db (patch)
tree185fe1b5a6de97a968c9013205b445fa3a7600a3 /lib
parent6523306602bd4cfaa7f78f744254a03e383ae2bf (diff)
lib/util/run: more error checking
Diffstat (limited to 'lib')
-rw-r--r--lib/util.lua8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/util.lua b/lib/util.lua
index 9f8cb22..f80ae87 100644
--- a/lib/util.lua
+++ b/lib/util.lua
@@ -161,8 +161,10 @@ local run = function (args)
capture_stdout = true,
args = args,
})
- stdout = cmd.stdout
- rc = (cmd.status >= 0)
+ if cmd then
+ stdout = cmd.stdout
+ rc = (cmd.status >= 0)
+ end
else
cmd = io.popen(table_to_cmd(args))
if cmd then
@@ -172,7 +174,7 @@ local run = function (args)
end
end
- return stdout, rc
+ return stdout or "", rc
end
return {