### 介绍
一个subprocess模块的封装,可以更方便的进行系统调用
To Do List:
1. return realtime result
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_capture('uptime')
>>> r.output
' 04:07:16 up 2 min, 1 user, load average: 0.11, 0.17, 0.08\n'
>>> r.success
True
>>> r.retcode
0
```
把输出的结果精简过,maxlines是控制行数
```
print(run_capture_limited('ls', maxlines=2).output)
```
easyrun example usage:
```
from easyrun import run_capture
r = run_capture('ls -la')
if r.success:
print(r.output)
else:
print("Error: '%s' exit code %s" % (r.command, r.retcode))
print(" ...")
# print last three lines of output
for line in r.output.splitlines()[-3:]:
print(" %s" % line)
```
一个subprocess模块的封装,可以更方便的进行系统调用
To Do List:
1. return realtime result
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_capture('uptime')
>>> r.output
' 04:07:16 up 2 min, 1 user, load average: 0.11, 0.17, 0.08\n'
>>> r.success
True
>>> r.retcode
0
```
把输出的结果精简过,maxlines是控制行数
```
print(run_capture_limited('ls', maxlines=2).output)
```
easyrun example usage:
```
from easyrun import run_capture
r = run_capture('ls -la')
if r.success:
print(r.output)
else:
print("Error: '%s' exit code %s" % (r.command, r.retcode))
print(" ...")
# print last three lines of output
for line in r.output.splitlines()[-3:]:
print(" %s" % line)
```
Metadata
Release files for easyrun 3.9.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| easyrun-3.9.3.tar.gz | 3.1 kB | Without provenance | Details |
Release files / easyrun-3.9.3.tar.gz
| Download URL | easyrun-3.9.3.tar.gz |
|---|---|
| Size | 3.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dc5ed5ed10c62bf357100cc04357e18028a8383d4f464b3e753bdce35f165c18
|
|
BLAKE2b-256 checksum How to use checksums |
fee19e6128c856550b2c165df99da046ff92ccb785e1ad3993dffe8e9d556006
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
Security for easyrun 3.9.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.