是shell脚本和命令之间的仲裁者。
diplomat的Python项目详细描述
外交官
diplomat
是shell脚本和命令之间的仲裁者。你给我
命令,它还给你外交官你可以询问
这些命令的状态、它们的输出以及包含它们的完整
到目前为止的产量。在
安装
pip install diplomat
使用
Diplomat
是一个高级的,但简单的命令和脚本接口。
您可以将shell命令作为变量参数给它,它将执行
它们异步地使用子进程,将输出写入文件。在
还可以通过提供out
和err
关键字重用输出文件
Diplomat
的构造函数的参数。在
一个Attachee
是一个没有特权的咕噜工人。它是一个只读副本
Diplomat
,或Diplomat
创建的文件的接口。在
fromdiplomatimportAttachee,Diplomatdiplo=Diplomat("ls","-l","example")diplo.wait()# we can create an attachee either from the diplomat directlyatt=diplo.to_attachee()# or from the file names; this is useful if we saved those# references somewhere, for instance in a databaseout=diplo.output_file_name()err=diplo.error_file_name()att=Attachee(out,err)
玩得开心!在
- 项目
标签: