- Subject: Re: [jed-users] new_process() can't handle input file > 65536 bytes?
- From: "John E. Davis" <jed@xxxxxxxxxxx>
- Date: Sun, 29 Jun 2025 15:44:06 -0400
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>.
[2025 date index]
[2025 thread index]
[Thread Prev] [Thread Next]
[Date Prev] [Date Next]