人类子流程2.0。
delegator.p的Python项目详细描述
delegator.py-人类子流程2.0
子流程图片::https://img.shields.io/pypi/v/delegator.py.svg
:目标:https://pypi.python.org/pypi/delegator.py
…图片::https://img.shields.io/pypi/l/delegator.py.svg
:目标:https://pypi.python.org/pypi/delegator.py
…图片::https://img.shields.io/pypi/wheel/delegator.py.svg
:目标:https://pypi.python.org/pypi/delegator.py
…图片::https://img.shields.io/pypi/pyversions/delegator.py.svg
:目标:https://pypi.python.org/pypi/delegator.py
…图片::https://img.shields.io/badge/sayThanks.io--1aedb.svg
:target:https://sayThanks.io/to/kennethreitz
**delegator.py**是一个处理子流程的简单库,受“特使”和“pexpect.http://pexpect.readthedocs.io>;`(事实上,这取决于它!).
此模块具有两个主要功能:“delegator.run()”和“delegator.chain()”。一个运行命令,不管是阻塞还是非阻塞,另一个运行命令链,由标准的unix管道操作符:`````.
如果您对资助kenneth reitz开源感兴趣,请考虑“访问此链接<;https://cash.me/$kennethritz>;`”。由于开源不再是我日常工作的一部分,您的支持极大地有助于激励的可持续性。
c=delegator.rstdelegator.repy
>
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>打印c.out
>readme.rstdelegator.py
>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>/>
命令可以也作为列表传入(例如`['ls','-lrt']``),用于参数化。
基本链功能:
。code:: pycon
# Can also be called with ([['fortune'], ['cowsay']]).
# or, delegator.run('fortune').pipe('cowsay')
>>> c = delegator.chain('fortune | cowsay')
>>> print c.out
_______________________________________
/ Our swords shall play the orators for \
| us. |
||||
expect功能也内置在非阻塞命令上:
…代码::pycon
>;>c.expect('password:')
>;>c.send('password')
>;>c.block()
密码:pycon
>
>gt>gt>gt;c.kill>br/>>>gt>gt>gt>gt>gt;c.send('sigterm,signal=true)
仅当block=true时才可用,否则,使用c.out。
>gt>gt>gt;c.err
>直接访问管道。
>c.std-err
><;打开文件<;fdopen>;'lt;打开文件>;'lt;模式;模式;模式;模式;打开打开文件;模式;模式;模式;模式;打开RU'位于0x10A5351e0>;< BR> > BR/>调整命令的环境变量(现有的将被重写)。
& gt;& gt;c=委托者。链('Env.GeReNeNeV’,Env= {NeNeNV’:‘FooWiBar’})
& Gt;& gt;& gt;c.out
newenv=foo_bar
----
:
$pip install delegator.py