From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org> To: Chris Sosnin <k.sosnin@tarantool.org> Cc: tarantool-patches@dev.tarantool.org Subject: Re: [Tarantool-patches] [PATCH v2 2/2] box: fix formatting in session.push Date: Fri, 3 Apr 2020 01:14:16 +0200 [thread overview] Message-ID: <e3a8f86c-bcde-9276-8082-32583cb3ddb7@tarantool.org> (raw) In-Reply-To: <7157885B-8F81-44C4-A317-1DA71CFC8008@tarantool.org> Hi! Thanks for the fixes! >>> + lua_pushvalue(L, -3); >>> + lua_pcall(L, 1, 1, 0); >> >> 2. In case lua_pcall() fails, the function should fail too, and should >> return NULL + set an error in diag. Also it would be good to have a >> test on it. > > I couldn’t really find a way to make serpent raise an error. Yeah, me neither. But anyway an error should be handled. With panic or with return -1, but we won't be able to test it. >> >>> } >>> - assert(rc == 1); >>> assert(lua_isstring(L, -1)); >>> size_t len; >>> const char *result = lua_tolstring(L, -1, &len); >>> diff --git a/src/box/lua/console.lua b/src/box/lua/console.lua >>> index 7208d3d30..fb7d9ca9b 100644 >>> --- a/src/box/lua/console.lua >>> +++ b/src/box/lua/console.lua >>> @@ -207,6 +208,18 @@ local function current_output() >>> end >>> end >>> >>> +-- Used by console_session_push. >>> +box_internal.format_lua_value = function(value) >>> + local opts = current_output()["opts"] >>> + value = format_lua_value(value, opts) >>> + return '-- Push begin\n' .. value .. '\n-- Push end\n' >> >> 3. Did you check that it is really necessary to append >> a special 'push end' tail? I couldn't find any Lua value, >> which couldn't be identified by 'push begin' and eos (';') >> markers. > > I agree, removed -- Push end Since there is no 'Push end' anymore, it should not be called 'Push begin'. I renamed it to just 'Push'. Also you didn't add a test on the push arriving out of bound. I did it on the branch. See my review fixes on top of this commit on the branch, and below. If you agree, squash them. If don't, then lets discuss.
next prev parent reply other threads:[~2020-04-02 23:14 UTC|newest] Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-03-13 14:58 [Tarantool-patches] [PATCH v2 0/2] box: fix session.push formatting Chris Sosnin 2020-03-13 14:58 ` [Tarantool-patches] [PATCH v2 1/2] refactoring: store output format in struct session Chris Sosnin 2020-03-15 17:27 ` Vladislav Shpilevoy 2020-03-13 14:58 ` [Tarantool-patches] [PATCH v2 2/2] box: fix formatting in session.push Chris Sosnin 2020-03-15 17:27 ` Vladislav Shpilevoy 2020-03-27 10:26 ` Chris Sosnin 2020-04-02 23:14 ` Vladislav Shpilevoy [this message] 2020-04-03 12:38 ` Chris Sosnin 2020-03-15 17:27 ` [Tarantool-patches] [PATCH v2 0/2] box: fix session.push formatting Vladislav Shpilevoy 2020-04-03 23:42 ` Vladislav Shpilevoy 2020-04-07 20:29 ` Vladislav Shpilevoy 2020-04-07 21:03 ` Nikita Pettik 2020-04-07 21:52 ` Chris Sosnin 2020-04-13 14:23 ` Kirill Yukhin
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=e3a8f86c-bcde-9276-8082-32583cb3ddb7@tarantool.org \ --to=v.shpilevoy@tarantool.org \ --cc=k.sosnin@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v2 2/2] box: fix formatting in session.push' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox