On Thursday, January 20, 2022 at 3:14:19 AM UTC-6,
[email protected]d wrote:
luser droog <[email protected]> wrote:
I may not completely follow what you're ultimately trying to do. But just in
case you haven't heard of it, there's a little known unix tool called expect(1)
that was designed to help with these sort of pipe/flushing issues. It was written by the same guy that wrote Tcl/tk.
That is not related, and does not help. (I am not sure how else to explain.) --
Don't laugh at the moon when it is day time in France.
Sorry about that. I've read the thread again and done some thinking.
But I fear the answer is just as you've discovered. According to
https://www.ghostscript.com/doc/current/Language.htm#File
" Ghostscript also supports the following IODevice in addition to a subset
of those defined in the Adobe documentation:
"%pipe%command, which opens a pipe on the given command. This is
supported only on operating systems that provide popen (primarily Unix
systems, and not all of those)."
Then (my local) `man popen` says:
" Use popen to create a stream to a child process executing a command string *s as
processed by /bin/sh on your system. The argument mode must start with either `r',
where the stream reads from the child's stdout, or `w', where the stream writes to
the child's stdin. As an extension, mode may also contain `e' to set the
close-on-exec bit of the parent's file descriptor. The stream created by popen must
be closed by pclose to avoid resource leaks."
So, I think ghostscript is using the minimal guarantees that POSIX gives
for popen(1) which is that you can read OR write from it. Ghoscript is presumably adding a "> /tmp/$$pipe-output" to your command line,
creating a writable pipe, and then giving you a read handle to that temp
file later on. That would explain the blocking that you're experiencing.
Bad news is I don't see any way to change it except by changing the C code that implements the %pipe% device.
--- SoupGate-Win32 v1.05
* Origin: fsxNet Usenet Gateway (21:1/5)