copen.py
This implements a set of command classes that behave like
file objects. This allows you fork off many different commands
and let the run concurrently.
Functions:
copen_sys Open a file-like pipe to a system command.
copen_fn Open a file-like pipe to a python function.
Imported modules
|
|
import os
import select
import signal
import sys
import time
import traceback
|
Functions
|
|
_cleanup
_handle_sigterm
copen_fn
copen_sys
|
|
_cleanup
|
_cleanup ()
_cleanup()
Close all active commands.
|
|
_handle_sigterm
|
_handle_sigterm ( signum, stackframe )
Handles a SIGTERM. Cleans up.
|
|
copen_fn
|
copen_fn (
func,
*args,
*keywords,
)
copen_fn(func, args, *keywords) -> file-like object
Open a file-like object that returns the output from function
call. The object's read method returns the return value from
the function. The function is executed as a separate process, so
any variables modified by the function does not affect the ones in
the parent process. The return value of the function must be
pickle-able.
|
|
copen_sys
|
copen_sys ( syscmd, *args )
copen_sys(syscmd, *args) -> file-like object
Open a file-like object that returns the output from a system
command.
|
Classes
|
|
|
|