From 8f0e30c4a23de4757232ec168c100f5fd1d302db Mon Sep 17 00:00:00 2001
From: sinanmohd <sinan@sinanmohd.com>
Date: Mon, 2 Oct 2023 11:33:30 +0530
Subject: lib/util/run: more error checking

---
 lib/util.lua | 8 +++++---
 1 file 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 {
-- 
cgit v1.2.3