From: Igor Munkin <imun@tarantool.org> To: Alexander Turenko <alexander.turenko@tarantool.org> Cc: tarantool-patches@dev.tarantool.org Subject: Re: [Tarantool-patches] [PATCH 2/2] popen: add popen Lua module Date: Mon, 20 Apr 2020 04:21:52 +0300 [thread overview] Message-ID: <20200420012152.GW8314@tarantool.org> (raw) In-Reply-To: <20200419222434.nnus7jnm2hgmeq6p@tkn_work_nb> Sasha, On 20.04.20, Alexander Turenko wrote: > Thanks for the careful proofreading! > > Aside of changes below I changed `popen.stream.OPENED (== 'opened')` to > `popen.stream.OPEN (== 'open')` to match english grammar. Same for > statuses -> status (yep, 'statuses' is allowed in English, but it is > ugly). Yep, that's the way much better. > > Force-pushed Totktonada/gh-4031-popen-13-full-ci. > > WBR, Alexander Turenko. > > ---- > <snipped> > > > > @param opts.env an array of environment variables to > > > be used inside a process; > > > - when is not set then the current > > > environment is inherited; > > > - if set then the environment will be > > > replaced > > > - if set to an empty array then the > > > environment will be dropped > > > > Minor: I looks more convenient to sort the lines above the following > > way: > > * when is not set <...> > > * if set to an empty table <...> > > * if set to a non-empty table <...> > > I don't mind. > > Reordered in the code and the commit message. > > Also I rephrased the description a bit to highlight the fact that the > parameter is key-value mapping, not an array. Good remark, thanks. > <snipped> > > > > The returned handle is subject to garbage collection, but > > > it may be freed explicitly using :close(). SIGKILL is sent > > > to the child process at :close() / GC if it is alive and > > > opts.keep_child is not set. > > > > Minor: Let's adjust the terminology. What do you mean speaking about > > "handle"? If it's a GC object, then there is no way to release it > > manually or "explicitly", only via platform GC. If it's a GC object > > *payload* then it's not managed by Lua GC and need to be explicitly > > released via special method or the corresponding __gc metamethod. > > My intention is to give two ideas here: > > * Feel free to use explicit :close() or lean on Lua GC. > * :close() / GC handler kills the child process. > > But being strict in terms and wording is goal for me too, so I reword > the paragraph to eliminate phrases, which requires a GC object / a GC > object payload as an object / a subject. > > Changed in the code and the commit: > > diff --git a/src/lua/popen.c b/src/lua/popen.c > index ec8c95662..31b4bc2b0 100644 > --- a/src/lua/popen.c > +++ b/src/lua/popen.c > @@ -1184,10 +1184,11 @@ luaT_popen_parse_mode(struct lua_State *L, int idx) > * :close() or collecting of the > * handle by Lua GC > * > - * The returned handle is subject to garbage collection, but > - * it may be freed explicitly using :close(). SIGKILL is sent > - * to the child process at :close() / GC if it is alive and > - * opts.keep_child is not set. > + * The returned handle provides :close() method to explicitly > + * release all occupied resources (including the child process > + * itself if @a opts.keep_child is not set). However if the > + * method is not called for a handle during its lifetime, the > + * same freeing actions will be triggered by Lua GC. > * > * It is recommended to use opts.setsid + opts.group_signal > * if a child process may spawn its own childs and they all Nice, now it's clear, thanks! > <snipped> > > > > Return `nil, err` on a failure. Possible reasons: > > > > > > - SocketError: an IO error occurs at read(). > > > > SocketError on pipe looks ridiculous to me. Maybe an IO one? > > It comes from coio.cc. It would be good to refactor it someday, but not > tonight :) And there is only one thing we say to Refactoring: “not today” :) > <snipped> -- Best regards, IM
next prev parent reply other threads:[~2020-04-20 1:28 UTC|newest] Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-04-18 4:13 [Tarantool-patches] [PATCH 0/2] Popen " Alexander Turenko 2020-04-18 4:13 ` [Tarantool-patches] [PATCH 1/2] popen: always free resources in popen_delete() Alexander Turenko 2020-04-18 6:55 ` Cyrill Gorcunov 2020-04-18 4:13 ` [Tarantool-patches] [PATCH 2/2] popen: add popen Lua module Alexander Turenko 2020-04-18 6:57 ` Cyrill Gorcunov 2020-04-19 12:38 ` Igor Munkin 2020-04-19 22:24 ` Alexander Turenko 2020-04-20 1:21 ` Igor Munkin [this message] 2020-04-20 0:57 ` Igor Munkin 2020-04-20 6:38 ` Alexander Turenko 2020-04-20 11:57 ` Igor Munkin 2020-04-21 13:38 ` Alexander Turenko 2020-04-20 7:52 ` [Tarantool-patches] [PATCH 0/2] Popen " 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=20200420012152.GW8314@tarantool.org \ --to=imun@tarantool.org \ --cc=alexander.turenko@tarantool.org \ --cc=tarantool-patches@dev.tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH 2/2] popen: add popen Lua module' \ /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