read from process - example wanted
Dar Scott
dsc at swcp.com
Tue Aug 19 11:10:01 EDT 2003
On Tuesday, August 19, 2003, at 06:31 AM, Rodney Tamblyn wrote:
> Mostly I'm just looking for a few pointers from anyone on the list who
> has experience working with reading/writing processes.
I have only done this once as an experiment on OS X, but I have done
this a bunch on Windows. I don't know the situation on OS X, but on
Windows it is a mess.
If you possibly can, use shell().
You can't use programs that provide info after the input is closed,
such as sort or find. You can't close the pipe to the process without
closing the pipe from the process. This isn't a bug, just a design
flaw.
Use the most simple read you can. I'd recommend regularly reading with
'until empty' to get what is in the buffer. The others are filled with
bugs on Windows.
I don't remember why, but I think I had to use a try-catch in the read
to handle a read attempt after the process closes the pipe. Or for
some reason. A simple condition that one would expect in the result is
a thrown error.
You should be able to set the shell process used in shell(), if you go
that way.
(If you are opening a Standalone process, I found problems with stdin,
stdout, and commandline parsing. I'd use IP)
If you still want an example, I might be able to find something that is
not in some intermediate hacked-to-find-combat-bugs state.
I tried to find a path through the mess of open/write/read process and,
for now, have given up. I hope to give it a fresh look, but I don't
know when.
Yes, I do--I will need to use the gnu pgp, soon. If I can't get
process to work, I'll redirect files to from the process using shell
and then burn the files. You might want to try that. Only, you
probably don't need to burn files. I will have to do some tricks with
the command line, but that is straight forward if there are no spaces
in arguments.
Remember, my bad experiences are on Windows 2000 and Windows XP.
Dar Scott
More information about the use-livecode
mailing list