Skip to content
Snippets Groups Projects
Commit 4efffe45 authored by Konstantin Nazarov's avatar Konstantin Nazarov Committed by Roman Tsisyk
Browse files

tarantoolctl connect doesn't report errors

This happens because console:eval swallows errors
and doesn't print them to stdout.

Also, console.connect() doesn't always call on_client_disconnect()
in case of errors, so the code that was meant to terminate local
session on errors, didn't do this in some cases and caused local
console to remain open.

Fixes #1586
parent 1361cb34
No related branches found
No related tags found
No related merge requests found
......@@ -547,9 +547,14 @@ local function enter()
end
local function connect()
local cmd = string.format("require('console').connect('%s')", arg[0])
console.on_start(function(self) self:eval(cmd) end)
console.on_start(function(self)
local status, reason
status, reason = pcall(function() require('console').connect(arg[0]) end)
if not status then
self:print(reason)
self.running = false
end
end)
console.on_client_disconnect(function(self) self.running = false end)
console.start()
return 0
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment