From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-f66.google.com (mail-lf1-f66.google.com [209.85.167.66]) (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 8CC7C46970F for ; Sat, 30 Nov 2019 15:16:07 +0300 (MSK) Received: by mail-lf1-f66.google.com with SMTP id r15so21521343lff.2 for ; Sat, 30 Nov 2019 04:16:07 -0800 (PST) Date: Sat, 30 Nov 2019 15:16:03 +0300 From: Cyrill Gorcunov Message-ID: <20191130121603.GA22394@uranus> References: <20191129113659.GE19879@uranus> <20191129145028.GA18043@atlas> <20191129151410.GJ19879@uranus> <20191129183144.GB16921@atlas> <20191129191708.GN19879@uranus> <20191130041405.GB31199@atlas> <20191130073628.GP19879@uranus> <20191130100445.GA16163@atlas> <20191130104734.GR19879@uranus> <20191130105454.GS19879@uranus> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191130105454.GS19879@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: Konstantin Osipov Cc: tml On Sat, Nov 30, 2019 at 01:54:54PM +0300, Cyrill Gorcunov wrote: > > Forgot to mention that the example in previous message is > for pipe opened in blocked mode. If o_nonblock used the > script fails in "read" action. I think the main target now > for me is to investigate which mode uses python in subprocess > module and etc (simply because users are familiar with it and > will expect us to behave the same I think). Python opens pipes in blocked mode --- sub.py import subprocess args=["sh", "-c", "prompt=''; read -n 5 prompt; echo $prompt"] process = subprocess.Popen(args, stdout=subprocess.PIPE) (stdout_data, stderr_data) = process.communicate() print(stdout_data) --- $ python3 sub.py 12345b'12345\n' So it waited for me to type "12345" on keyboard and echo'ed it back. If we look into strace output we will see | pipe2([3, 4], O_CLOEXEC) = 0 so I think we should follow the convention and open pipes in blocking mode. Still we could provide an option to open in nonblocking mode if user wants. Cyrill