run command
Project description
Install
$ [sudo] pip install runcmd
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 - add background=True
>>> r = runcmd.run(["sleep","5"],background=True)
>>> while r.running: # True if process is running and not "zombie process"
>>> print("running")
_raise()
- raise exception if code is not 0
>>> runcmd.run(["ls"])._raise() # code 0, ok
>>> runcmd.run(["mkdir", "/"])._raise() # code 1, error
...
OSError: exited with code 1
mkdir: /: Is a directory
ok
- True
if code is 0
>>> if r.ok:
text
- out+err
>>> r.text
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-0.0.3.tar.gz
(2.2 kB
view hashes)
Built Distribution
Close
Hashes for runcmd-0.0.3-py2.py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0a4499b6017a3f02bb1b513b76e1d8ef7f6e25c1e0db38ecd71564446b0b1a8d |
|
MD5 | 3aabc8d7ebfc61289c45ac42aab01aa7 |
|
BLAKE2b-256 | 1e248cc117b3b55833134e3549f9b816945a6d2629271e2c4da3ed03b1365573 |