- Subject: Re: [jed-users] new_process() can't handle input file > 65536 bytes?
- From: Tom Culliton <tom.culliton@xxxxxxxxx>
- Date: Sun, 29 Jun 2025 16:27:36 -0400
FWIW, John's point was probably "The way you've written it is going to
deadlock at some point. Don't do that." ;-)
On Sun, Jun 29, 2025, 16:12 Tom Culliton <tom.culliton@xxxxxxxxx> wrote:
> Yeah, but likely a system pipe buffer size.
>
> On Sun, Jun 29, 2025, 16:10 Roland Hughes <roland@xxxxxxxxxxxxxxxxxxxx>
> wrote:
>
>> Color me confused.
>>
>> If he deletes one line from the scratch buffer of 65537 lines it works.
>>
>> If the buffer is 65537 (or presumably greater) it doesn't.
>>
>> How does it work with just one line less if cat is always waiting for
>> input?
>>
>> It's okay to say I'm an imbecile here. I'm desperately trying to get all
>> of the page breaks and numbers into a new novel that will hopefully be
>> available for sale prior to the fourth, so might have missed something.
>> It sure sounded like he ran headlong into a hard coded 64K buffer size
>> somewhere.
>>
>> On 6/29/2025 2:44 PM, John E. Davis wrote:
>> > Morten Bo Johansen <mbj@xxxxxxxxx> wrote:
>> >> If you have the time, then create a file, "t", of 65537 bytes
>> >>
>> >> $ for i in {1..65537}; do echo -n a >> t; done
>> >>
>> >> In a *scratch* buffer, insert the following lines:
>> >>
>> >> require("process");
>> >> variable obj = new_process(["cat"]; write=1, stdin="t");
>> >> () = obj.wait();
>> > The issue here is that the "cat" process is waiting for you to read
>> > the data. For example, add
>> >
>> > () = fgets (&str, obj.fp1);
>> >
>> > before calling the wait method. If you want the output of cat to go
>> > to stdout, then omit the write=1 qualifier. From the documentation:
>> >
>> > write=fds
>> >
>> > fds is a list of integer file descriptors that are open for write
>> > access in the subprocess, and may be read to by the calling
>> > process using the fdN or fpN fields of the structure.
>> > [...]
>> > Mimic popen(pgm, "r"):
>> >
>> > obj = new_process (pgm; write=1); % Read from obj.fp1
>> >
>> > I hope this helps,
>> > --John
>> >
>> >
>> >> and then:
>> >>
>> >> alt-x evalbuffer
>> >>
>> >> In my case the process hangs/freezes.
>> >>
>> >> If I remove one single 'a' from the file "t" to make the size 65536
>> bytes,
>> >> then it completes.
>> >>
>> >> Is it a case of some integer data type somewhere in the slang source
>> files
>> >> that should be changed or is it just me who don't know what I'm doing?
>> >>
>> >> Regards,
>> >> Morten
>> >> _______________________________________________
>> >> For list information, visit <http://jedsoft.org/jed/mailinglists.html
>> >.
>> >>
>> > _______________________________________________
>> > For list information, visit <http://jedsoft.org/jed/mailinglists.html>.
>> >
>> --
>> Roland Hughes, President
>> Logikal Solutions
>> (630)-205-1593 (cell)
>> https://theminimumyouneedtoknow.com
>> https://infiniteexposure.net
>> https://johnsmith-book.com
>>
>> _______________________________________________
>> For list information, visit <http://jedsoft.org/jed/mailinglists.html>.
>>
>>
[2025 date index]
[2025 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]