From 2f3c8648289bb4e22eee5f8ff8d27afca6592fa4 Mon Sep 17 00:00:00 2001 From: roboo Date: Sun, 21 Aug 2016 21:50:38 +0200 Subject: Windows and appveyor support for tests --- spec/install_spec.lua | 36 ++++++++++++++++++++++-------------- 1 file changed, 22 insertions(+), 14 deletions(-) (limited to 'spec/install_spec.lua') diff --git a/spec/install_spec.lua b/spec/install_spec.lua index bd480c21..2b6cb77f 100644 --- a/spec/install_spec.lua +++ b/spec/install_spec.lua @@ -12,8 +12,8 @@ local extra_rocks = { "/lpeg-0.12-1.src.rock", "/luasec-0.6-1.rockspec", "/luassert-1.7.0-1.src.rock", - "/luasocket-3.0rc1-1.src.rock", - "/luasocket-3.0rc1-1.rockspec", + "/luasocket-3.0rc1-2.src.rock", + "/luasocket-3.0rc1-2.rockspec", "/lxsh-0.8.6-2.src.rock", "/lxsh-0.8.6-2.rockspec", "/say-1.2-1.src.rock", @@ -44,8 +44,8 @@ describe("LuaRocks install tests #blackbox #b_install", function() assert.is_false(run.luarocks_bool("install \"invalid.rock\" ")) end) - it("LuaRocks install with local flag as root", function() - assert.is_false(run.luarocks_bool("install --local luasocket", { USER = "root" } )) + it("LuaRocks install with local flag as root #unix", function() + assert.is_false(run.luarocks_bool("install --local luasocket ", { USER = "root" } )) end) it("LuaRocks install not a zip file", function() @@ -66,14 +66,22 @@ describe("LuaRocks install tests #blackbox #b_install", function() end) it("LuaRocks install luasec and show luasocket (dependency)", function() - assert.is_true(run.luarocks_bool("install luasec")) + if test_env.APPVEYOR then + assert.is_true(run.luarocks_bool(test_env.quiet("install luasec " .. test_env.APPVEYOR_OPENSSL))) + else + assert.is_true(run.luarocks_bool(test_env.quiet("install luasec"))) + end assert.is_true(run.luarocks_bool("show luasocket")) end) end) describe("LuaRocks install - more complex tests", function() it('LuaRocks install luasec with skipping dependency checks', function() - run.luarocks_bool(test_env.quiet(" install luasec --nodeps")) + if test_env.APPVEYOR then + assert.is_true(run.luarocks_bool(test_env.quiet("install luasec " .. test_env.APPVEYOR_OPENSSL .. " --nodeps"))) + else + assert.is_true(run.luarocks_bool(test_env.quiet("install luasec --nodeps"))) + end assert.is_true(run.luarocks_bool(test_env.quiet("show luasec"))) if env_variables.TYPE_TEST_ENV == "minimal" then assert.is_false(run.luarocks_bool(test_env.quiet("show luasocket"))) @@ -83,17 +91,17 @@ describe("LuaRocks install tests #blackbox #b_install", function() end) it("LuaRocks install only-deps of luasocket packed rock", function() - assert.is_true(run.luarocks_bool(test_env.quiet("build --pack-binary-rock luasocket 3.0rc1-1"))) - local output = run.luarocks("install --only-deps " .. "luasocket-3.0rc1-1." .. test_env.platform .. ".rock") - assert.are.same(output, "Successfully installed dependencies for luasocket 3.0rc1-1") - assert.is_true(os.remove("luasocket-3.0rc1-1." .. test_env.platform .. ".rock")) + assert.is_true(run.luarocks_bool(test_env.quiet("build --pack-binary-rock luasocket 3.0rc1-2"))) + local output = run.luarocks("install --only-deps " .. "luasocket-3.0rc1-2." .. test_env.platform .. ".rock") + assert.are.same(output, "Successfully installed dependencies for luasocket 3.0rc1-2") + assert.is_true(os.remove("luasocket-3.0rc1-2." .. test_env.platform .. ".rock")) end) it("LuaRocks install reinstall", function() - assert.is_true(run.luarocks_bool(test_env.quiet("build --pack-binary-rock luasocket 3.0rc1-1"))) - assert.is_true(run.luarocks_bool("install " .. "luasocket-3.0rc1-1." .. test_env.platform .. ".rock")) - assert.is_true(run.luarocks_bool("install --deps-mode=none " .. "luasocket-3.0rc1-1." .. test_env.platform .. ".rock")) - assert.is_true(os.remove("luasocket-3.0rc1-1." .. test_env.platform .. ".rock")) + assert.is_true(run.luarocks_bool(test_env.quiet("build --pack-binary-rock luasocket 3.0rc1-2"))) + assert.is_true(run.luarocks_bool("install " .. "luasocket-3.0rc1-2." .. test_env.platform .. ".rock")) + assert.is_true(run.luarocks_bool("install --deps-mode=none " .. "luasocket-3.0rc1-2." .. test_env.platform .. ".rock")) + assert.is_true(os.remove("luasocket-3.0rc1-2." .. test_env.platform .. ".rock")) end) it("LuaRocks install binary rock of cprint", function() -- cgit v1.2.3-55-g6feb From 6d9c9997645c07ed93719d85e260d9ffbc2d1d25 Mon Sep 17 00:00:00 2001 From: roboo Date: Mon, 22 Aug 2016 21:01:23 +0200 Subject: Change APPVEYOR_OPENSSL to OPENSSL_DIRS for better test readability --- spec/build_spec.lua | 18 +++--------------- spec/install_spec.lua | 12 ++---------- spec/pack_spec.lua | 6 +----- spec/upload_spec.lua | 12 ++---------- 4 files changed, 8 insertions(+), 40 deletions(-) (limited to 'spec/install_spec.lua') diff --git a/spec/build_spec.lua b/spec/build_spec.lua index b4f838ca..8f08f0a0 100644 --- a/spec/build_spec.lua +++ b/spec/build_spec.lua @@ -120,11 +120,7 @@ describe("LuaRocks build tests #blackbox #b_build", function() end) it("LuaRocks build luasec with skipping dependency checks", function() - if test_env.APPVEYOR then - assert.is_true(run.luarocks_bool("build luasec " .. test_env.APPVEYOR_OPENSSL .. " --nodeps")) - else - assert.is_true(run.luarocks_bool("build luasec --nodeps")) - end + assert.is_true(run.luarocks_bool("build luasec " .. test_env.OPENSSL_DIRS .. " --nodeps")) assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasec/0.6-1/luasec-0.6-1.rockspec")) end) @@ -150,11 +146,7 @@ describe("LuaRocks build tests #blackbox #b_build", function() end it("LuaRocks build luasec only deps", function() - if test_env.APPVEYOR then - assert.is_true(run.luarocks_bool(test_env.quiet("build luasec " .. test_env.APPVEYOR_OPENSSL .. " --only-deps"))) - else - assert.is_true(run.luarocks_bool(test_env.quiet("build luasec --only-deps"))) - end + assert.is_true(run.luarocks_bool(test_env.quiet("build luasec " .. test_env.OPENSSL_DIRS .. " --only-deps"))) assert.is_false(run.luarocks_bool("show luasec")) assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasec/0.6-1/luasec-0.6-1.rockspec")) end) @@ -189,12 +181,8 @@ describe("LuaRocks build tests #blackbox #b_build", function() it("LuaRocks build with https", function() assert.is_true(run.luarocks_bool("download --rockspec validate-args 1.5.4-1")) + assert.is_true(run.luarocks_bool(test_env.quiet("install luasec " .. test_env.OPENSSL_DIRS))) - if test_env.APPVEYOR then - assert.is_true(run.luarocks_bool(test_env.quiet("install luasec " .. test_env.APPVEYOR_OPENSSL))) - else - assert.is_true(run.luarocks_bool(test_env.quiet("install luasec"))) - end assert.is_true(run.luarocks_bool("build validate-args-1.5.4-1.rockspec")) assert.is.truthy(run.luarocks("show validate-args")) assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/validate-args/1.5.4-1/validate-args-1.5.4-1.rockspec")) diff --git a/spec/install_spec.lua b/spec/install_spec.lua index 2b6cb77f..e5b9e2cc 100644 --- a/spec/install_spec.lua +++ b/spec/install_spec.lua @@ -66,22 +66,14 @@ describe("LuaRocks install tests #blackbox #b_install", function() end) it("LuaRocks install luasec and show luasocket (dependency)", function() - if test_env.APPVEYOR then - assert.is_true(run.luarocks_bool(test_env.quiet("install luasec " .. test_env.APPVEYOR_OPENSSL))) - else - assert.is_true(run.luarocks_bool(test_env.quiet("install luasec"))) - end + assert.is_true(run.luarocks_bool(test_env.quiet("install luasec " .. test_env.OPENSSL_DIRS))) assert.is_true(run.luarocks_bool("show luasocket")) end) end) describe("LuaRocks install - more complex tests", function() it('LuaRocks install luasec with skipping dependency checks', function() - if test_env.APPVEYOR then - assert.is_true(run.luarocks_bool(test_env.quiet("install luasec " .. test_env.APPVEYOR_OPENSSL .. " --nodeps"))) - else - assert.is_true(run.luarocks_bool(test_env.quiet("install luasec --nodeps"))) - end + assert.is_true(run.luarocks_bool(test_env.quiet("install luasec " .. test_env.OPENSSL_DIRS .. " --nodeps"))) assert.is_true(run.luarocks_bool(test_env.quiet("show luasec"))) if env_variables.TYPE_TEST_ENV == "minimal" then assert.is_false(run.luarocks_bool(test_env.quiet("show luasocket"))) diff --git a/spec/pack_spec.lua b/spec/pack_spec.lua index 21f33b02..3191e80c 100644 --- a/spec/pack_spec.lua +++ b/spec/pack_spec.lua @@ -49,11 +49,7 @@ describe("LuaRocks pack tests #blackbox #b_pack", function() end) it("LuaRocks pack src", function() - if test_env.APPVEYOR then - assert.is_true(run.luarocks_bool(test_env.quiet("install luasec " .. test_env.APPVEYOR_OPENSSL))) - else - assert.is_true(run.luarocks_bool(test_env.quiet("install luasec"))) - end + assert.is_true(run.luarocks_bool(test_env.quiet("install luasec " .. test_env.OPENSSL_DIRS))) assert.is_true(run.luarocks_bool("download --rockspec luasocket 3.0rc1-2")) assert.is_true(run.luarocks_bool("pack luasocket-3.0rc1-2.rockspec")) assert.is_true(test_env.remove_files(lfs.currentdir(), "luasocket-")) diff --git a/spec/upload_spec.lua b/spec/upload_spec.lua index af4c36d3..ff39cb96 100644 --- a/spec/upload_spec.lua +++ b/spec/upload_spec.lua @@ -63,18 +63,10 @@ describe("LuaRocks upload tests #blackbox #b_upload", function() end) it("LuaRocks upload rockspec with api-key", function() - if test_env.APPVEYOR then - assert.is_true(run.luarocks_bool("upload " .. testing_paths.testing_server .. "/luasocket-3.0rc1-2.rockspec " .. test_env.APPVEYOR_OPENSSL .. " --api-key=123", {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/luarocks_site.lua"})) - else - assert.is_true(run.luarocks_bool("upload " .. testing_paths.testing_server .. "/luasocket-3.0rc1-2.rockspec --api-key=123", {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/luarocks_site.lua"})) - end + assert.is_true(run.luarocks_bool("upload " .. testing_paths.testing_server .. "/luasocket-3.0rc1-2.rockspec " .. test_env.OPENSSL_DIRS .. " --api-key=123", {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/luarocks_site.lua"})) end) it("LuaRocks upload rockspec with api-key and skip-pack", function() - if test_env.APPVEYOR then - assert.is_true(run.luarocks_bool("upload --skip-pack " .. testing_paths.testing_server .. "/luasocket-3.0rc1-2.rockspec " .. test_env.APPVEYOR_OPENSSL .. " --api-key=123", {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/luarocks_site.lua"})) - else - assert.is_true(run.luarocks_bool("upload --skip-pack " .. testing_paths.testing_server .. "/luasocket-3.0rc1-2.rockspec --api-key=123", {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/luarocks_site.lua"})) - end + assert.is_true(run.luarocks_bool("upload --skip-pack " .. testing_paths.testing_server .. "/luasocket-3.0rc1-2.rockspec " .. test_env.OPENSSL_DIRS .. " --api-key=123", {LUAROCKS_CONFIG = testing_paths.testing_dir .. "/luarocks_site.lua"})) end) end) end) -- cgit v1.2.3-55-g6feb From f91fc9a6ef9ef488c709894a29ce63db2bc1e399 Mon Sep 17 00:00:00 2001 From: Hisham Date: Thu, 8 Sep 2016 14:04:40 -0300 Subject: Tests: luarocks_bool commands log their outputs on failure. --- spec/build_spec.lua | 8 ++++---- spec/help_spec.lua | 4 ++-- spec/install_spec.lua | 12 ++++++------ spec/make_spec.lua | 8 ++++---- spec/pack_spec.lua | 4 ++-- spec/search_spec.lua | 2 +- test/test_environment.lua | 22 +++++++++++++++++++--- 7 files changed, 38 insertions(+), 22 deletions(-) (limited to 'spec/install_spec.lua') diff --git a/spec/build_spec.lua b/spec/build_spec.lua index 8f08f0a0..2ff7cbe6 100644 --- a/spec/build_spec.lua +++ b/spec/build_spec.lua @@ -92,7 +92,7 @@ describe("LuaRocks build tests #blackbox #b_build", function() describe("LuaRocks build - basic builds", function() it("LuaRocks build luadoc", function() - assert.is_true(run.luarocks_bool(test_env.quiet("build luadoc"))) + assert.is_true(run.luarocks_bool("build luadoc")) end) it("LuaRocks build luacov diff version", function() @@ -114,7 +114,7 @@ describe("LuaRocks build tests #blackbox #b_build", function() if test_env.TEST_TARGET_OS == "windows" then assert.is_false(run.luarocks_bool("build lpty")) --Error: This rockspec for lpty does not support win32, windows platforms else - assert.is_true(run.luarocks_bool(test_env.quiet("build lpty"))) + assert.is_true(run.luarocks_bool("build lpty")) assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lpty/1.0.1-1/lpty-1.0.1-1.rockspec")) end end) @@ -146,7 +146,7 @@ describe("LuaRocks build tests #blackbox #b_build", function() end it("LuaRocks build luasec only deps", function() - assert.is_true(run.luarocks_bool(test_env.quiet("build luasec " .. test_env.OPENSSL_DIRS .. " --only-deps"))) + assert.is_true(run.luarocks_bool("build luasec " .. test_env.OPENSSL_DIRS .. " --only-deps")) assert.is_false(run.luarocks_bool("show luasec")) assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasec/0.6-1/luasec-0.6-1.rockspec")) end) @@ -181,7 +181,7 @@ describe("LuaRocks build tests #blackbox #b_build", function() it("LuaRocks build with https", function() assert.is_true(run.luarocks_bool("download --rockspec validate-args 1.5.4-1")) - assert.is_true(run.luarocks_bool(test_env.quiet("install luasec " .. test_env.OPENSSL_DIRS))) + assert.is_true(run.luarocks_bool("install luasec " .. test_env.OPENSSL_DIRS)) assert.is_true(run.luarocks_bool("build validate-args-1.5.4-1.rockspec")) assert.is.truthy(run.luarocks("show validate-args")) diff --git a/spec/help_spec.lua b/spec/help_spec.lua index 88aa5030..71b1b9f6 100644 --- a/spec/help_spec.lua +++ b/spec/help_spec.lua @@ -10,7 +10,7 @@ describe("LuaRocks help tests #blackbox #b_help", function() end) it("LuaRocks help with no flags/arguments", function() - assert.is_true(run.luarocks_bool(test_env.quiet("help"))) + assert.is_true(run.luarocks_bool("help")) end) it("LuaRocks help invalid argument", function() @@ -18,7 +18,7 @@ describe("LuaRocks help tests #blackbox #b_help", function() end) it("LuaRocks help config", function() - assert.is_true(run.luarocks_bool(test_env.quiet("help config"))) + assert.is_true(run.luarocks_bool("help config")) end) it("LuaRocks-admin help with no flags/arguments", function() diff --git a/spec/install_spec.lua b/spec/install_spec.lua index e5b9e2cc..8857e4bd 100644 --- a/spec/install_spec.lua +++ b/spec/install_spec.lua @@ -66,15 +66,15 @@ describe("LuaRocks install tests #blackbox #b_install", function() end) it("LuaRocks install luasec and show luasocket (dependency)", function() - assert.is_true(run.luarocks_bool(test_env.quiet("install luasec " .. test_env.OPENSSL_DIRS))) + assert.is_true(run.luarocks_bool("install luasec " .. test_env.OPENSSL_DIRS)) assert.is_true(run.luarocks_bool("show luasocket")) end) end) describe("LuaRocks install - more complex tests", function() it('LuaRocks install luasec with skipping dependency checks', function() - assert.is_true(run.luarocks_bool(test_env.quiet("install luasec " .. test_env.OPENSSL_DIRS .. " --nodeps"))) - assert.is_true(run.luarocks_bool(test_env.quiet("show luasec"))) + assert.is_true(run.luarocks_bool("install luasec " .. test_env.OPENSSL_DIRS .. " --nodeps")) + assert.is_true(run.luarocks_bool("show luasec")) if env_variables.TYPE_TEST_ENV == "minimal" then assert.is_false(run.luarocks_bool(test_env.quiet("show luasocket"))) assert.is.falsy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket")) @@ -83,21 +83,21 @@ describe("LuaRocks install tests #blackbox #b_install", function() end) it("LuaRocks install only-deps of luasocket packed rock", function() - assert.is_true(run.luarocks_bool(test_env.quiet("build --pack-binary-rock luasocket 3.0rc1-2"))) + assert.is_true(run.luarocks_bool("build --pack-binary-rock luasocket 3.0rc1-2")) local output = run.luarocks("install --only-deps " .. "luasocket-3.0rc1-2." .. test_env.platform .. ".rock") assert.are.same(output, "Successfully installed dependencies for luasocket 3.0rc1-2") assert.is_true(os.remove("luasocket-3.0rc1-2." .. test_env.platform .. ".rock")) end) it("LuaRocks install reinstall", function() - assert.is_true(run.luarocks_bool(test_env.quiet("build --pack-binary-rock luasocket 3.0rc1-2"))) + assert.is_true(run.luarocks_bool("build --pack-binary-rock luasocket 3.0rc1-2")) assert.is_true(run.luarocks_bool("install " .. "luasocket-3.0rc1-2." .. test_env.platform .. ".rock")) assert.is_true(run.luarocks_bool("install --deps-mode=none " .. "luasocket-3.0rc1-2." .. test_env.platform .. ".rock")) assert.is_true(os.remove("luasocket-3.0rc1-2." .. test_env.platform .. ".rock")) end) it("LuaRocks install binary rock of cprint", function() - assert.is_true(run.luarocks_bool(test_env.quiet("build --pack-binary-rock cprint"))) + assert.is_true(run.luarocks_bool("build --pack-binary-rock cprint")) assert.is_true(run.luarocks_bool("install cprint-0.1-2." .. test_env.platform .. ".rock")) assert.is_true(os.remove("cprint-0.1-2." .. test_env.platform .. ".rock")) end) diff --git a/spec/make_spec.lua b/spec/make_spec.lua index 624badff..ae79a29c 100644 --- a/spec/make_spec.lua +++ b/spec/make_spec.lua @@ -30,10 +30,10 @@ describe("LuaRocks make tests #blackbox #b_make", function() assert.is_true(run.luarocks_bool("download --source luasocket 3.0rc1-2")) assert.is_true(run.luarocks_bool("unpack luasocket-3.0rc1-2.src.rock")) lfs.chdir("luasocket-3.0rc1-2/luasocket-3.0-rc1/") - assert.is_true(run.luarocks_bool(test_env.quiet("make luasocket-3.0rc1-2.rockspec"))) + assert.is_true(run.luarocks_bool("make luasocket-3.0rc1-2.rockspec")) -- test it - assert.is_true(run.luarocks_bool(test_env.quiet("show luasocket"))) + assert.is_true(run.luarocks_bool("show luasocket")) assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/luasocket/3.0rc1-2/luasocket-3.0rc1-2.rockspec")) -- delete downloaded and unpacked files @@ -69,7 +69,7 @@ describe("LuaRocks make tests #blackbox #b_make", function() test_env.copy("lxsh-0.8.6-2.rockspec", "rockspec") assert.is_true(run.luarocks_bool("make")) - assert.is_true(run.luarocks_bool(test_env.quiet("show lxsh"))) + assert.is_true(run.luarocks_bool("show lxsh")) assert.is.truthy(lfs.attributes(testing_paths.testing_sys_tree .. "/lib/luarocks/rocks/lxsh/0.8.6-2/lxsh-0.8.6-2.rockspec")) os.remove("rockspec") end) @@ -94,7 +94,7 @@ describe("LuaRocks make tests #blackbox #b_make", function() end) it("LuaRocks make pack binary rock", function() - assert.is_true(run.luarocks_bool(test_env.quiet("make --deps-mode=none --pack-binary-rock"))) + assert.is_true(run.luarocks_bool("make --deps-mode=none --pack-binary-rock")) assert.is.truthy(lfs.attributes("lxsh-0.8.6-2.all.rock")) end) end) diff --git a/spec/pack_spec.lua b/spec/pack_spec.lua index 3191e80c..3c9ed9fd 100644 --- a/spec/pack_spec.lua +++ b/spec/pack_spec.lua @@ -25,7 +25,7 @@ describe("LuaRocks pack tests #blackbox #b_pack", function() end) it("LuaRocks pack basic", function() - assert.is_true(run.luarocks_bool(test_env.quiet("pack luacov"))) + assert.is_true(run.luarocks_bool("pack luacov")) assert.is_true(test_env.remove_files(lfs.currentdir(), "luacov-")) end) @@ -49,7 +49,7 @@ describe("LuaRocks pack tests #blackbox #b_pack", function() end) it("LuaRocks pack src", function() - assert.is_true(run.luarocks_bool(test_env.quiet("install luasec " .. test_env.OPENSSL_DIRS))) + assert.is_true(run.luarocks_bool("install luasec " .. test_env.OPENSSL_DIRS)) assert.is_true(run.luarocks_bool("download --rockspec luasocket 3.0rc1-2")) assert.is_true(run.luarocks_bool("pack luasocket-3.0rc1-2.rockspec")) assert.is_true(test_env.remove_files(lfs.currentdir(), "luasocket-")) diff --git a/spec/search_spec.lua b/spec/search_spec.lua index f75bc3c1..04f84eeb 100644 --- a/spec/search_spec.lua +++ b/spec/search_spec.lua @@ -30,6 +30,6 @@ describe("LuaRocks search tests #blackbox #b_search", function() end) it("LuaRocks search with flag all", function() - assert.is_true(run.luarocks_bool(test_env.quiet("search --all"))) + assert.is_true(run.luarocks_bool("search --all")) end) end) diff --git a/test/test_environment.lua b/test/test_environment.lua index 00213d31..8239795d 100644 --- a/test/test_environment.lua +++ b/test/test_environment.lua @@ -119,13 +119,29 @@ function test_env.execute_helper(command, print_command, env_variables) end --- Execute command and returns true/false --- In Lua5.1 os.execute returns numeric value, but in Lua5.2+ returns boolean -- @return true/false boolean: status of the command execution local function execute_bool(command, print_command, env_variables) command = test_env.execute_helper(command, print_command, env_variables) - local ok = os.execute(command) - return ok == true or ok == 0 + local redirect_filename + local redirect = "" + if print_command ~= nil then + redirect_filename = test_env.testing_paths.luarocks_tmp.."/output.txt" + redirect = " > "..redirect_filename + end + local ok = os.execute(command .. redirect) + ok = (ok == true or ok == 0) -- normalize Lua 5.1 output to boolean + if redirect ~= "" then + if not ok then + local fd = io.open(redirect_filename, "r") + if fd then + print(fd:read("*a")) + fd:close() + end + end + os.remove(redirect_filename) + end + return ok end --- Execute command and returns output of command -- cgit v1.2.3-55-g6feb