From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-f195.google.com (mail-lj1-f195.google.com [209.85.208.195]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id AB4E746970F for ; Sat, 30 Nov 2019 13:04:48 +0300 (MSK) Received: by mail-lj1-f195.google.com with SMTP id c19so7446608lji.11 for ; Sat, 30 Nov 2019 02:04:48 -0800 (PST) Date: Sat, 30 Nov 2019 13:04:45 +0300 From: Konstantin Osipov Message-ID: <20191130100445.GA16163@atlas> References: <20191129055939.GH15149@atlas> <20191129094059.GA19879@uranus> <20191129111903.GA7760@atlas> <20191129113659.GE19879@uranus> <20191129145028.GA18043@atlas> <20191129151410.GJ19879@uranus> <20191129183144.GB16921@atlas> <20191129191708.GN19879@uranus> <20191130041405.GB31199@atlas> <20191130073628.GP19879@uranus> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191130073628.GP19879@uranus> Subject: Re: [Tarantool-patches] [PATCH 1/5] popen: Introduce a backend engine List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cyrill Gorcunov Cc: tml * Cyrill Gorcunov [19/11/30 10:39]: > > * Cyrill Gorcunov [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