A python library of subprocess module wrapper.
Project description
subprocrunner
Summary
A python library of subprocess module wrapper.
Examples
Execute a command
from subprocrunner import SubprocessRunner
runner = SubprocessRunner("echo test")
print("command: {:s}".format(runner.command))
print("return code: {:d}".format(runner.run()))
print("stdout: {:s}".format(runner.stdout))
runner = SubprocessRunner("ls __not_exist_dir__")
print("command: {:s}".format(runner.command))
print("return code: {:d}".format(runner.run()))
print("stderr: {:s}".format(runner.stderr))
command: echo test
return code: 0
stdout: test
command: ls __not_exist_dir__
return code: 2
stderr: ls: cannot access '__not_exist_dir__': No such file or directory
Get command history
from subprocrunner import SubprocessRunner
SubprocessRunner.clear_history()
SubprocessRunner.is_save_history = True
SubprocessRunner("echo hoge").run()
SubprocessRunner("echo foo").run()
print("\n".join(SubprocessRunner.get_history()))
echo hoge
echo foo
Installation
pip install subprocrunner
Dependencies
Python 2.7+ or 3.3+
Test dependencies
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
subprocrunner-0.8.1.tar.gz
(6.7 kB
view hashes)
Built Distribution
Close
Hashes for subprocrunner-0.8.1-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 35b15ade0045eafa8444f88d014cb0c61a37e21f053efc4bd9a7da409adc7341 |
|
MD5 | 5a3c16cdd7a2ffa39892899033014d6e |
|
BLAKE2b-256 | b3129a0d2526ced48274e140b0d092f19fef50808346ce4f8f4d59a99d6f96bc |