def fork(executable, args=(), env={}, path=None, timeout=3600):
"""fork
Provides a deferred wrapper function with a timeout function
:param executable: Executable
:type executable: str.
:param args: Tupple of arguments
:type args: tupple.
:param env: Environment dictionary
:type env: dict.
:param timeout: Kill the child process if timeout is exceeded
:type timeout: int.
"""
de = defer.Deferred()
proc = ProcessProtocol(de, timeout)
reactor.spawnProcess(proc, executable, (executable,)+tuple(args), env,
path)
return de
评论列表
文章目录