diff options
author | Hisham Muhammad <hisham@gobolinux.org> | 2015-03-04 16:14:52 -0300 |
---|---|---|
committer | Hisham Muhammad <hisham@gobolinux.org> | 2015-03-04 16:14:52 -0300 |
commit | 5f3d39033ecf74a6e959053548cba436ff9bfb24 (patch) | |
tree | bb1c686426d3092b370ab1821f6e03020032aec5 | |
parent | 46f2d252c42d5040a472cb96732b16a19d83efd3 (diff) | |
download | luarocks-5f3d39033ecf74a6e959053548cba436ff9bfb24.tar.gz luarocks-5f3d39033ecf74a6e959053548cba436ff9bfb24.tar.bz2 luarocks-5f3d39033ecf74a6e959053548cba436ff9bfb24.zip |
Don't crash when asking for help on invalid cmd.
-rw-r--r-- | src/luarocks/help.lua | 2 | ||||
-rwxr-xr-x | test/testing.sh | 1 |
2 files changed, 2 insertions, 1 deletions
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(...) | |||
100 | end | 100 | end |
101 | else | 101 | else |
102 | command = command:gsub("-", "_") | 102 | command = command:gsub("-", "_") |
103 | local cmd = require(commands[command]) | 103 | local cmd = commands[command] and require(commands[command]) |
104 | if cmd then | 104 | if cmd then |
105 | local arguments = cmd.help_arguments or "<argument>" | 105 | local arguments = cmd.help_arguments or "<argument>" |
106 | print_banner() | 106 | 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 | |||
365 | test_download_rockspecversion() { $luarocks download --rockspec validate-args ${verrev_validate_args} && rm validate-args-*; } | 365 | test_download_rockspecversion() { $luarocks download --rockspec validate-args ${verrev_validate_args} && rm validate-args-*; } |
366 | 366 | ||
367 | test_help() { $luarocks help; } | 367 | test_help() { $luarocks help; } |
368 | fail_help_invalid() { $luarocks help invalid; } | ||
368 | 369 | ||
369 | test_install_binaryrock() { $luarocks build --pack-binary-rock cprint && $luarocks install ./cprint-${verrev_cprint}.${platform}.rock && rm ./cprint-${verrev_cprint}.${platform}.rock; } | 370 | test_install_binaryrock() { $luarocks build --pack-binary-rock cprint && $luarocks install ./cprint-${verrev_cprint}.${platform}.rock && rm ./cprint-${verrev_cprint}.${platform}.rock; } |
370 | test_install_with_bin() { $luarocks install wsapi; } | 371 | test_install_with_bin() { $luarocks install wsapi; } |