module Shell_uq:Run shell commands within Unixqueuessig
..end
Shell_sys
for
more information.Shell_sys.configure_job_handlers
and
Shell_sys.install_job_handlers
for this purpose. This is not
done automatically.
Note that this has a global side effect on the whole process, because
there is only one set of signal handlers.
class type['a]
system_handler_engine_type =object
..end
system_handler
to
Shell_sys.register_job
in order to watch a running job.
class system_handler_engine :Unixqueue.event_system ->
[unit]
system_handler_engine_type
Shell_sys.system_handler
, and can
be used to watch an already started job_instance
as created by
Shell_sys.run_job
until the job is done.
class type['a]
job_handler_engine_type =object
..end
system_handler_engine_type
, this type of engine
returns the job
and the job_instance
.
class call_engine :?ignore_error_code:bool -> ?mode:Shell_sys.group_mode -> ?stdin:Shell.producer -> ?stdout:Shell.consumer -> ?stderr:Shell.consumer -> Shell_sys.command list -> Unixqueue.event_system ->
[Shell_sys.job_status]
job_handler_engine_type
Shell.call
.
All examples presented for the Shell
module can be easily rewritten
for Shell_uq
. For example, to call "ls" and collect the result in a
buffer, use this piece of code:
let ues = Unixqueue.create_unix_event_system();;
let b = Buffer.create 10;;
let e = new call_engine ~stdout:(Shell.to_buffer b) [ Shell.command "ls" ];;
Unixqueue.run ues;;
let r = Buffer.contents b;;
This means, one simply creates a call_engine
instead of invoking
Shell.call
, and then runs the queue. Note that you must look at
e#state
to find out whether the engine e
produced an error, no
exception is raised in this case.
It is allowed (and somehow the purpose of this module) to create
several job engines, and let them run in parallel.