run shell command
Project description
Installation
$ [sudo] pip install runcmd
Classes
class | __doc__ |
---|---|
runcmd.Process |
Process class |
Functions
function | __doc__ |
---|---|
runcmd.run(args, cwd=None, background=False) |
run command and return Process object |
Examples
>>> import runcmd
>>> r = runcmd.run(["echo", "hello world"])
>>> r.code # exit status code
0
>>> r.out # stdout
'hello world'
>>> r.err # stderr
''
>>> r.pid # process pid
1234
background=True
>>> r = runcmd.run(["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
>>> runcmd.run(["ls"]).exc() # code 0, ok
>>> runcmd.run(["mkdir", "/"]).exc() # code 1, raise OSError
...
OSError: exited with code 1
mkdir: /: Is a directory
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
runcmd-2019.3.22.tar.gz
(2.6 kB
view hashes)
Built Distribution
runcmd-2019.3.22-py2.py3-none-any.whl
(154.7 kB
view hashes)
Close
Hashes for runcmd-2019.3.22-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f31388e47091a1a5fd105571d7c151e2afda46274c9c5d089192b79408bf6036 |
|
MD5 | 2e2d49cc9e2fcc85464a9d7938383a12 |
|
BLAKE2b-256 | 06d0af99ba8d99e5b0f69cbf298e92e4ac9f96f90fb96a7d5ff66caab7516e6c |