From b4f32b4d095587982911bb4cf925638d136f902d Mon Sep 17 00:00:00 2001 From: hisham Date: Tue, 12 May 2009 19:16:34 +0000 Subject: Add test for io.popen git-svn-id: http://luarocks.org/svn/luarocks/trunk@22 9ca3f7c1-7366-0410-b1a3-b5c78f85698c --- src/luarocks/cfg.lua | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/luarocks/cfg.lua b/src/luarocks/cfg.lua index d0de70cc..5afb653d 100644 --- a/src/luarocks/cfg.lua +++ b/src/luarocks/cfg.lua @@ -1,6 +1,6 @@ -local rawset, next, table, pairs, print, require, io, os, setmetatable = - rawset, next, table, pairs, print, require, io, os, setmetatable +local rawset, next, table, pairs, print, require, io, os, setmetatable, pcall = + rawset, next, table, pairs, print, require, io, os, setmetatable, pcall --- Configuration for LuaRocks. -- Tries to load the user's configuration file and @@ -13,6 +13,17 @@ program_version = "1.1" local persist = require("luarocks.persist") +local popen_ok, popen_result = pcall(io.popen, "") +if popen_ok then + if popen_result then + result:close() + end +else + print("Your version of Lua does not support io.popen,") + print("which is required by LuaRocks. Please check your Lua installation.") + os.exit(1) +end + local detected = {} local system,proc -- cgit v1.2.3-55-g6feb