Skip to content

Commit 29cabb0

Browse files
committed
Fix formatting for some expressions in server.lua
1 parent 77e9291 commit 29cabb0

File tree

1 file changed

+12
-25
lines changed

1 file changed

+12
-25
lines changed

luatest/server.lua

+12-25
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,8 @@ function Server:initialize()
277277
local max_unix_socket_path = {linux = 107, other = 103}
278278
local system = os.execute('[ $(uname) = Linux ]') == 0 and 'linux' or 'other'
279279
if parsed_net_box_uri.unix:len() > max_unix_socket_path[system] then
280-
error(('Unix domain socket path cannot be longer than %d chars. ' ..
281-
'Current path is: %s'):format(max_unix_socket_path[system],
282-
parsed_net_box_uri.unix))
280+
error(('Unix domain socket path cannot be longer than %d chars. Current path is: %s')
281+
:format(max_unix_socket_path[system], parsed_net_box_uri.unix))
283282
end
284283
end
285284
if type(self.net_box_uri) == 'table' then
@@ -572,27 +571,16 @@ function Server:stop()
572571
if not ok and not err:find('Process is terminated when waiting for') then
573572
error(err)
574573
end
575-
if self.process.output_beautifier.stderr:find('Segmentation fault') then
576-
error(
577-
('Segmentation fault during process termination (alias: %s, workdir: %s, pid: %d)\n%s')
578-
:format(
579-
self.alias,
580-
fio.basename(self.workdir),
581-
self.process.pid,
582-
self.process.output_beautifier.stderr
583-
)
584-
)
574+
local workdir = fio.basename(self.workdir)
575+
local pid = self.process.pid
576+
local stderr = self.process.output_beautifier.stderr
577+
if stderr:find('Segmentation fault') then
578+
error(('Segmentation fault during process termination (alias: %s, workdir: %s, pid: %d)\n%s')
579+
:format(self.alias, workdir, pid, stderr))
585580
end
586-
if self.process.output_beautifier.stderr:find('LeakSanitizer') then
587-
error(
588-
('Memory leak during process execution (alias: %s, workdir: %s, pid: %s)\n%s')
589-
:format(
590-
self.alias,
591-
fio.basename(self.workdir),
592-
self.process.pid,
593-
self.process.output_beautifier.stderr
594-
)
595-
)
581+
if stderr:find('LeakSanitizer') then
582+
error(('Memory leak during process execution (alias: %s, workdir: %s, pid: %s)\n%s')
583+
:format(self.alias, workdir, pid, stderr))
596584
end
597585
log.info('Process of server %s (pid: %d) killed', self.alias, self.process.pid)
598586
self.process = nil
@@ -833,8 +821,7 @@ function Server:exec(fn, args, options)
833821
end
834822

835823
if not are_fn_args_array(fn, args) then
836-
error(('bad argument #3 for exec at %s: an array is required')
837-
:format(utils.get_fn_location(fn)))
824+
error(('bad argument #3 for exec at %s: an array is required'):format(utils.get_fn_location(fn)))
838825
end
839826

840827
-- The function `fn` can return multiple values and we cannot use the

0 commit comments

Comments
 (0)