Skip to main content

run shell command

Project description


$ [sudo] pip install runcmd


runcmd.Process - Process class

method __doc__
__bool__() return True if status code is 0
exc() raise OSError if status code is not 0. returns self
kill(signal=None) kill process. return error string if error occured
@property __doc__
args return arguments list
code return status code
err return stderr string
ok return True if status code is 0, else False
out return stdout string
pid return rocess pid
running return True if process is running, else False


function __doc__, cwd=None, background=False) run command and return Process object


>>> import runcmd
>>> r =["echo", "hello world"])
>>> r.code  # exit status code
>>> r.out  # stdout
'hello world'
>>> r.err  # stderr
>>>  # process pid


>>> r =["sleep","5"],background=True)
>>> while r.running:  # True if process is running and not "zombie process"
>>>     print("running")

kill(signal=None) - kill process

>>> r.kill(-9)

exc() - raise exception if code is not 0

>>>["ls"]).exc()              # code 0, ok
>>>["mkdir", "/"]).exc()      # code 1, raise OSError
OSError: exited with code 1
mkdir: /: Is a directory

readme-md - generator

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

runcmd-2018.12.10.tar.gz (2.6 kB view hashes)

Uploaded Source

Built Distribution

runcmd-2018.12.10-py2.py3-none-any.whl (3.3 kB view hashes)

Uploaded Python 2 Python 3

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