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 details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file runcmd-0.0.3.tar.gz.
File metadata
- Download URL: runcmd-0.0.3.tar.gz
- Upload date:
- Size: 2.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c27cb55052ac1b56204bf72494c970d49efa1c7356e8120af4e9ae21b82d39ef
|
|
| MD5 |
44bd5c0357c44577cd4adb5bb8c185b4
|
|
| BLAKE2b-256 |
5a06901db89b1375bff80f2b00a1e9568fcdf203fcda3f7edf9b6a28747c667c
|
File details
Details for the file runcmd-0.0.3-py2.py3-none-any.whl.
File metadata
- Download URL: runcmd-0.0.3-py2.py3-none-any.whl
- Upload date:
- Size: 2.8 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/40.0.0 requests-toolbelt/0.8.0 tqdm/4.24.0 CPython/3.6.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0a4499b6017a3f02bb1b513b76e1d8ef7f6e25c1e0db38ecd71564446b0b1a8d
|
|
| MD5 |
3aabc8d7ebfc61289c45ac42aab01aa7
|
|
| BLAKE2b-256 |
1e248cc117b3b55833134e3549f9b816945a6d2629271e2c4da3ed03b1365573
|