Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/kennethreitz-archive/procs
Python, Processes, and Prana.
https://github.com/kennethreitz-archive/procs
Last synced: 13 days ago
JSON representation
Python, Processes, and Prana.
- Host: GitHub
- URL: https://github.com/kennethreitz-archive/procs
- Owner: kennethreitz-archive
- Archived: true
- Created: 2014-10-29T19:56:25.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2015-03-10T18:01:40.000Z (over 9 years ago)
- Last Synced: 2024-08-04T04:05:22.315Z (3 months ago)
- Language: Python
- Size: 327 KB
- Stars: 226
- Watchers: 23
- Forks: 7
- Open Issues: 6
-
Metadata Files:
- Readme: README.rst
Awesome Lists containing this project
README
Procs: Python, Processes, and... Pipes
======================================Python's Subprocess module is well designed for lower functions. Pipes is designed
to encourage higher functions.Ideas
------ Simple shelling out, allow argument seperation.
- command timeouts
- Process monitoring
- programatically compose a chain of streams.
- process call timeoutsUsage
-----Simple Usage::
>>> import procs
>>> c = procs.run('uptime')
>>> c.returncode
0
>>> c.ok
True
>>> print c.stdout
16:08 up 1:16, 7 users, load averages: 1.02 1.90 1.75Advanced Usage::
>>> ls = procs.Process('ls /usr/bin')
>>> grep = procs.Process('grep python')
>>> wc = procs.Process('wc -l')
>>> chain = ls | grep | wc
>>> chain.run()
>>> print(chain.stdout)
19>>> from procs import ProcessHandler
class MyCommmand(ProcessHandler):
def __init__(self):
passdef on_start(self):
passdef on_exit(self):
passdef on_crash(self):
pass