Re: [code] [textadept] Strange behaviour in spawn_proc:write(…)

From: Mitchell <>
Date: Sat, 2 Jan 2016 13:50:47 -0500 (EST)


On Wed, 7 Oct 2015, Mitchell wrote:

> Hi Giovanni,
> On Tue, 6 Oct 2015, Giovanni Salmeri wrote:
>>> Can you break up your input into 64K chunks and pass each
>>> individually without the artificial waiting? That may be the better
>>> practice.
>> I have changed proc:write(text) with
>> local chunk = 65536
>> for i = 0, #text // chunk do
>> proc:write(text:sub(1+chunk*i, chunk*(i+1)))
>> end
>> Now all seems to work perfectly, thank you!
>> (I'm wondering if this manner of writing in the stdin shouldn't be the
>> normal one under the hood, to avoid such problems.)
> Yes, I'll fix the underlying proc:write() to write in 64K chunks.

Some months ago I ran into a roadblock writing in 64K chunks. I shelved it
until today. However, I cannot find a way to fix it.

I've discovered that I do not understand *nix pipes. On my 64-bit Linux
machine, anytime I try to write more than 65535*3 bytes (192K) to a
process's stdin, I get a block. It doesn't matter if those bytes are split
into 64K chunks, 4K chunks, or not split at all. I can write up to 192K
over a pipe without a problem (even without chunking!).

If anyone has any ideas, I'd like to hear them. Otherwise for now I'm just
going to make a note in the LuaDoc for `proc:write()` that data > 64K may
need to be chunked (as in Giovanni's case), but there may also be a 192K
limit (as in my case). It sounds pretty silly writing these speculations
into the docs, but I really don't know what's going on...


You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Sat 02 Jan 2016 - 13:50:47 EST

This archive was generated by hypermail 2.2.0 : Sun 03 Jan 2016 - 06:45:52 EST