-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The /shutdown
command is broken.
#7223
Labels
Comments
SmallJoker
added
Bug
Issues that were confirmed to be a bug
@ Server / Client / Env.
labels
Apr 7, 2018
Shutdown 900 gives a message of "Shutting down in 1m 30s" by the way. |
Possible minetest/builtin/game/chatcommands.lua Line 827 in 460b375
local tests = {
"60 yes Need to restart.",
"-1 1", -- Empty message but valid
"120 0",
"120 true NUMBER 15",
"600 false Cheese steak jimmy's"
}
for i, v in pairs(tests) do
delay, reconnect, message = v:match("^%s*(%-?%d+)%s+([%a%d]+)(.*)")
assert(delay)
assert(reconnect)
assert(message)
print(delay, reconnect, message)
end |
How about this local tests = {
"",
"9",
"73",
"817",
" 817",
"1e3",
"120 0",
"120 1",
"120 y",
"120 yes",
"120 no",
"120 true",
"120 false",
"120 false", -- extra space
"120 true a shutdown message",
"120 true a shutdown message", -- odd spacing
"120 true 3.14159 and some words",
"-1",
"-1 1", -- setting reconnect is pointless with a negative delay
"-31 1 this message will never be seen",
}
for _, param in ipairs(tests) do
local delay, reconnect, message = nil, nil, nil
delay, param = param:match("^%s*(%S+)(.*)")
if param then reconnect, param = param:match("^%s*(%S+)(.*)") end
if param then message = param:match("^%s*(.+)") end
delay = tonumber(delay) or 0
message = message or ""
print(delay, reconnect, message)
end All tests pass
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Issue type
Minetest version
OS / Hardware
ALL
Summary
The
/shutdown
command is buggy.Steps to reproduce
Type
Expected behavior
The server waits 90 seconds to shutdown then clients display the shutdown message and present a button to reconnect.
Actual behavior
The server shuts-down immediately. Clients present a generic shutdown message and do not display a button to reconnect.
See
builtin/game/chatcommands.lua
line 827.The text was updated successfully, but these errors were encountered: