Skip to main content

A python library of subprocess module wrapper.

Project description

subprocrunner

https://badge.fury.io/py/subprocrunner.svg https://img.shields.io/pypi/pyversions/subprocrunner.svg https://img.shields.io/travis/thombashi/subprocrunner/master.svg?label=Linux https://img.shields.io/appveyor/ci/thombashi/subprocrunner/master.svg?label=Windows https://coveralls.io/repos/github/thombashi/subprocrunner/badge.svg?branch=master

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


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.0.tar.gz (6.7 kB view details)

Uploaded Source

Built Distribution

subprocrunner-0.8.0-py2.py3-none-any.whl (7.3 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file subprocrunner-0.8.0.tar.gz.

File metadata

File hashes

Hashes for subprocrunner-0.8.0.tar.gz
Algorithm Hash digest
SHA256 ba0995e8c769175727d03492d7a401786fdd906f3101a85f123c3923f190b1c8
MD5 7b3ab2f2fe705be71c8d2081bfc44db3
BLAKE2b-256 80e4492011be623ca0a15921780ffd5f73cb49d55e7dfa4a92218a4532369291

See more details on using hashes here.

File details

Details for the file subprocrunner-0.8.0-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for subprocrunner-0.8.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 df6ed1d1f8dd6536d405a4d634260a2711fae271d9843822bf140e210205fe4f
MD5 4455e191c14ed7417b18613243ea0161
BLAKE2b-256 34cce31ec36b369bd4ab847354f7a6b2c88e1222b08350a8dafd6446d6edf66a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page