Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
print: add callbacks at calling print() function
Those callbacks will be set from the console module (which integrates readline into tarantool), so the print() output won't mix with readline prompting. Part of #7169 NO_DOC=no user visible changes, it is internal API NO_TEST=will be tested in a next commit together with the console callbacks itself NO_CHANGELOG=no user visible changes
- Loading branch information
1 parent
15386e4
commit b6ba22d
Showing
4 changed files
with
68 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
local M = {} | ||
|
||
M.raw_print = print | ||
|
||
-- before_cb() and after_cb() must not raise an error, must not | ||
-- yield. It would break expectations about the print() function. | ||
_G.print = function(...) | ||
if M.before_cb ~= nil then | ||
M.before_cb() | ||
end | ||
M.raw_print(...) | ||
if M.after_cb ~= nil then | ||
M.after_cb() | ||
end | ||
end | ||
|
||
return M |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters