Path: csiph.com!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail From: Robert Klemme Newsgroups: comp.lang.ruby Subject: Re: How to flush stdin to popen3 without closing it? Date: Sun, 26 Feb 2017 22:53:21 +0100 Lines: 19 Message-ID: References: <8760jwkiyv.fsf@filestore.home.gustad.com> <87h93gd3s7.fsf@filestore.home.gustad.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Trace: individual.net WhixsSNO2wMVSeuWi/oKvwGWzBhBDGe3/77WaNlC3DfokCLck= Cancel-Lock: sha1:18QVBs7ubihomggZWdR9oBSp4K0= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.7.0 In-Reply-To: <87h93gd3s7.fsf@filestore.home.gustad.com> Xref: csiph.com comp.lang.ruby:7341 On 26.02.2017 22:46, Petter Gustad wrote: > Again, thanks! You're welcome! Just one more caveat, which might not apply in this case but a general advice for #popen and the likes: buffers between processes are limited. If you handle everything single threaded there is potential for deadlock. This will always happen if you send more data longer than the buffer size to the pipe and the other process will also send more than buffer size data. Then both are blocked on IO. Kind regards robert -- remember.guy do |as, often| as.you_can - without end http://blog.rubybestpractices.com/