From 5f3d39033ecf74a6e959053548cba436ff9bfb24 Mon Sep 17 00:00:00 2001 From: Hisham Muhammad Date: Wed, 4 Mar 2015 16:14:52 -0300 Subject: Don't crash when asking for help on invalid cmd. --- src/luarocks/help.lua | 2 +- test/testing.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/src/luarocks/help.lua b/src/luarocks/help.lua index 0a155509..e6c214ff 100644 --- a/src/luarocks/help.lua +++ b/src/luarocks/help.lua @@ -100,7 +100,7 @@ function help.run(...) end else command = command:gsub("-", "_") - local cmd = require(commands[command]) + local cmd = commands[command] and require(commands[command]) if cmd then local arguments = cmd.help_arguments or "" print_banner() diff --git a/test/testing.sh b/test/testing.sh index 4b159892..5018abe0 100755 --- a/test/testing.sh +++ b/test/testing.sh @@ -365,6 +365,7 @@ test_download_all() { $luarocks download --all validate-args && rm validate-args test_download_rockspecversion() { $luarocks download --rockspec validate-args ${verrev_validate_args} && rm validate-args-*; } test_help() { $luarocks help; } +fail_help_invalid() { $luarocks help invalid; } test_install_binaryrock() { $luarocks build --pack-binary-rock cprint && $luarocks install ./cprint-${verrev_cprint}.${platform}.rock && rm ./cprint-${verrev_cprint}.${platform}.rock; } test_install_with_bin() { $luarocks install wsapi; } -- cgit v1.2.3-55-g6feb