mirror of
https://github.com/not-kennethreitz/envoy.git
synced 2026-06-05 23:20:19 +00:00
d9b70c8a9bbf3db14bec2a0908c1bc14526ca87c
- Keeps Python 2.7 and 2.6 compatibility
- Is not compatible with Python 2.5, as the original code never was.
This is due to two problems:
1. Use of the `Thread.is_alive()` method. Python 2.5 only
provides `Thread.isAlive()`.
2. Use of the `Popen.terminate()` and `Popen.kill()` methods,
which only exist in Python >= 2.6
Envoy: Python Subprocesses for Humans.
======================================
**Note:** Work in progress.
This is a convenience wrapper around the `subprocess` module.
You don't need this.
.. image:: https://github.com/kennethreitz/envoy/raw/master/ext/in_action.png
But you want it.
Usage
-----
Run a command, get the response::
>>> r = envoy.run('git config', data='data to pipe in', timeout=2)
>>> r.status_code
129
>>> r.std_out
'usage: git config [options]'
>>> r.std_err
''
Pipe stuff around too::
>>> r = envoy.run('uptime | pbcopy')
>>> r.command
'pbcopy'
>>> r.status_code
0
>>> r.history
[<Response 'uptime'>]
Languages
Python
100%