[Tarantool-patches] [PATCH 1/5] popen: Introduce a backend engine

Konstantin Osipov kostja.osipov at gmail.com
Sat Nov 30 13:04:45 MSK 2019


* Cyrill Gorcunov <gorcunov at gmail.com> [19/11/30 10:39]:
> > * Cyrill Gorcunov <gorcunov at gmail.com> [19/11/30 07:03]:
> > > Once we sart using non-blocking IO the read() could return -EAGAIN.
> > > I think I need to find out how python is handling this situation,
> > > is their read is blocking or not.
> > 
> > Take a look at how coio works. It adds the descriptor to the event
> > loop and yields the current fiber.
> 
> I will, thanks! You know there is another problem with nonblocking
> descriptors: consider a case where user runs a script like in my
> test "input=''; read -n 5 input; echo $input". If you run it inside
> a regular terminal the script will wait for input to apprear first,
> but if we provide nonblocking pipe the "read" will exit with
> -EAGAIN and script fail. Actually my first implementations have been
> creating pipes with O_NONBLOCK and since such test case start to fail
> I dropped O_NONBLOCK then.

Could you provide a Lua example usage of popen() which would lead 
to the situation you describe here?

Seems like in order for that to happen the Lua script has to
provide both input and output streams to the called program, and
in this case the script should not expect that there is any
ordering in which the input is consumed and the output is
produced.

In any case discussing this problem would be easier if there is an
example.

-- 
Konstantin Osipov, Moscow, Russia


More information about the Tarantool-patches mailing list