Run shell commands within Unixqueues
This module is not thread-safe. See the module
Signal handlers: It is important to have a number of signal handlers installed for proper function of the engines. It is recommended to call the pair of functions 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.
This engine corresponds to Shell.call. The command list is
executed until the job is done. In this case,
the status of the engine changes to
ignore_error_code, failed jobs are reported by the
`Error Subprocess_failure. If
failed jobs are ignored, and result in the status
(however, jobs terminated by signals are still reported as
All examples presented for the [root:Shell] module can be easily rewritten
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.