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

Uploaded Source

Built Distribution

subprocrunner-0.5.0-py2.py3-none-any.whl (7.1 kB view details)

Uploaded Python 2 Python 3

File details

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

File metadata

File hashes

Hashes for subprocrunner-0.5.0.tar.gz
Algorithm Hash digest
SHA256 cf98dda16760388cfe2d4833d70d63bc103694aa5f0804b316d62ff8dc27512c
MD5 14b7465301feb56cece37c8f05ca3cb6
BLAKE2b-256 cfeecb87f97b50d49d29de8c249729b4c532b4ee7f1225cb54960f2669a56b28

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for subprocrunner-0.5.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 362fc82addb4f5ec25f0db7167f6dbdd40ab6a7e762428811c1444c7062b72aa
MD5 586afc00d99429fe3d6863e32ab29530
BLAKE2b-256 a310b8f109b69a7006d85c9e2b44f4b0a6dd70ad32431078a77be70a9461a489

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