From 16d0062a9f0d0c0af4ccf6d2c469cd361025f933 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20N=C3=BCcke?= Date: Wed, 6 Aug 2014 13:29:49 +0200 Subject: [PATCH] Giving a clearer error message if programs cannot be started because the set shell cannot be found, closes #470. --- .../assets/opencomputers/loot/OpenOS/lib/shell.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/resources/assets/opencomputers/loot/OpenOS/lib/shell.lua b/src/main/resources/assets/opencomputers/loot/OpenOS/lib/shell.lua index 5affade8d..961b831c1 100644 --- a/src/main/resources/assets/opencomputers/loot/OpenOS/lib/shell.lua +++ b/src/main/resources/assets/opencomputers/loot/OpenOS/lib/shell.lua @@ -11,7 +11,11 @@ local aliases = {} local shells = setmetatable({}, {__mode="v"}) local function getShell() - local shellName = shell.resolve(os.getenv("SHELL"), "lua") + local shellPath = os.getenv("SHELL") or "/bin/sh" + local shellName, reason = shell.resolve(shellPath, "lua") + if not shellName then + return nil, "cannot resolve shell `" .. shellPath .. "': " .. reason + end if shells[shellName] then return shells[shellName] end