一个简单的子流程管理器,支持流stdout\async
easyrun的Python项目详细描述
###一、子流程系统返回实时结果
2。task async run
[开发easyrun的环境是python3哦]
### 安装
pip安装
```
pip install easyrun
```
源码安装
```
git clone git@github.com:rfyiamcool/easyrun.git
cd easyrun
python setup.py install
```
### 使用方法
只单纯的执行,然后返回linux run code和执行状态
```
>>> import easyrun
>>> r = easyrun.run('uptime')
04:06:37 up 2 min, 1 user, load average: 0.20, 0.19, 0.08
>>> r.output
>>> r.success
True
>>> r.retcode
0
```
捕捉所有的执行结果
```
>>> r=easyrun.run'u capture('uptime')
>>gt;r.output
'04:07:16 up 2分钟,1用户,平均负载:0.11,0.17,0.08\n'
>;r.success
>true
>;r.retcode
>0
``
>true
>;r.retcode
>0
`
>
r.retcode
r.retcode
>0
0
>```>br/>
br/>26159控“BR/>‘BR/> BR/> EasyRun示例用法:
‘BR/>从EasyRun导入RunyCopysBR/> BR/> R= RunIsP俘获(“LS -LA”)< BR> > R.Value:Br/> Prime:(R.Outlook输出)
其他:
打印(“错误:%s”退出代码%s”%(R.Cube),r.retcode))
打印(“…”
打印r.output.splitlines()[-3:]:
打印(“%s%”行)
```
2。task async run
[开发easyrun的环境是python3哦]
### 安装
pip安装
```
pip install easyrun
```
源码安装
```
git clone git@github.com:rfyiamcool/easyrun.git
cd easyrun
python setup.py install
```
### 使用方法
只单纯的执行,然后返回linux run code和执行状态
```
>>> import easyrun
>>> r = easyrun.run('uptime')
04:06:37 up 2 min, 1 user, load average: 0.20, 0.19, 0.08
>>> r.output
>>> r.success
True
>>> r.retcode
0
```
捕捉所有的执行结果
```
>>> r=easyrun.run'u capture('uptime')
>>gt;r.output
'04:07:16 up 2分钟,1用户,平均负载:0.11,0.17,0.08\n'
>;r.success
>true
>;r.retcode
>0
``
>true
>;r.retcode
>0
`
>
r.retcode
r.retcode
>0
0
>```>br/>
br/>26159控“BR/>‘BR/> BR/> EasyRun示例用法:
‘BR/>从EasyRun导入RunyCopysBR/> BR/> R= RunIsP俘获(“LS -LA”)< BR> > R.Value:Br/> Prime:(R.Outlook输出)
其他:
打印(“错误:%s”退出代码%s”%(R.Cube),r.retcode))
打印(“…”
打印r.output.splitlines()[-3:]:
打印(“%s%”行)
```