Re: Second instance
- Posted by jimcbrown (admin) Dec 06, 2015
- 1681 views
Unfortunately, Euphoria currently lacks a cross-platform library for
controlling processes.
Not true. There is std/pipeio.e
The Pipe I/O library is only useful if you simply want to start a process and then forget about it.
Until we can determine the status of the process we started, I don't see it as terribly useful.
This is the type of loop we'll need if we want Pipe I/O to be useful:
atom p = process:exec( "my command" ) while process:is_running( p ) do sequence data = process:read( p ) -- do stuff end while
I was under the impression that one could do this today:
constant ESRCH = 3 object z = pipeio:create() object p = pipeio:exec( "my command", z ) while pipeio:get_errno() != ESRCH with entry do sequence data = pipeio:read( p[STDOUT] ) -- do stuff entry -- check if process is still alive and set errno appropriately if not pipeio:kill( p, 0 ) end while -- clean up by closing the pipes pipeio:kill( p )
Unfortunately, Euphoria currently lacks a cross-platform library for
enumerating
processes.
True. Though this is really easy on most flavors of nix - just search the files in /proc
Yes, but it's inherently more complicated on Windows, as we know many things there are.
I suppose get_process_list() is just something that needs to go on the "wishlist" of features for Euphoria.
-Greg
No argument from me on this. It's probably simple enough that if someone had a patch, we could sneak it into 4.1.0 and 4.0.6