update docs
Markus Gerstel
5 years ago
1 | 1 |
Credits
|
2 | 2 |
=======
|
3 | 3 |
|
4 | |
Development Lead
|
5 | |
----------------
|
6 | |
|
7 | |
* Markus Gerstel <scientificsoftware@diamond.ac.uk>
|
|
4 |
* Markus Gerstel
|
8 | 5 |
|
9 | 6 |
Contributors
|
10 | 7 |
------------
|
0 | 0 |
=======
|
1 | 1 |
History
|
2 | 2 |
=======
|
|
3 |
|
|
4 |
0.3.0
|
|
5 |
-----
|
|
6 |
|
|
7 |
* run_process() renamed to run()
|
|
8 |
|
|
9 |
0.2.0 (2018-03-12)
|
|
10 |
------------------
|
|
11 |
|
|
12 |
* Procrunner is now Python3 3.3-3.6 compatible.
|
3 | 13 |
|
4 | 14 |
0.1.0 (2018-03-12)
|
5 | 15 |
------------------
|
29 | 29 |
Features
|
30 | 30 |
--------
|
31 | 31 |
|
32 | |
* TODO
|
|
32 |
* runs an external process and waits for it to finish
|
|
33 |
* does not deadlock, no matter the process stdout/stderr output behaviour
|
|
34 |
* returns the exit code, stdout, stderr (separately), and the total process
|
|
35 |
runtime as a dictionary
|
|
36 |
* process can run in a custom environment, either as a modification of
|
|
37 |
the current environment or in a new environment from scratch
|
|
38 |
* stdin can be fed to the process, the returned dictionary contains
|
|
39 |
information how much was read by the process
|
|
40 |
* stdout and stderr is printed by default, can be disabled
|
|
41 |
* stdout and stderr can be passed to any arbitrary function for
|
|
42 |
live processing
|
|
43 |
* optionally enforces a time limit on the process
|
33 | 44 |
|
34 | 45 |
Credits
|
35 | 46 |
-------
|
|
0 |
===
|
|
1 |
API
|
|
2 |
===
|
|
3 |
|
|
4 |
.. automodule:: procrunner
|
|
5 |
:members:
|
|
6 |
:show-inheritance:
|
|
7 |
|
7 | 7 |
readme
|
8 | 8 |
installation
|
9 | 9 |
usage
|
10 | |
modules
|
|
10 |
api
|
11 | 11 |
contributing
|
12 | 12 |
authors
|
13 | 13 |
history
|
14 | 14 |
|
15 | 15 |
Indices and tables
|
16 | 16 |
==================
|
17 | |
* :ref:`genindex`
|
18 | |
* :ref:`modindex`
|
19 | 17 |
* :ref:`search`
|
4 | 4 |
To use ProcRunner in a project::
|
5 | 5 |
|
6 | 6 |
import procrunner
|
|
7 |
result = procrunner.run(['/bin/ls', '/some/path/containing spaces'])
|
|
8 |
|
|
9 |
To test for successful completion::
|
|
10 |
|
|
11 |
assert result['exitcode'] == 0
|
|
12 |
|
|
13 |
To test for no STDERR output::
|
|
14 |
|
|
15 |
assert result['stderr'] == ''
|
|
16 |
|
|
17 |
To run with a specific environment variable set::
|
|
18 |
|
|
19 |
result = procrunner.run(..., environment_override={ 'VARIABLE': 'value' })
|
|
20 |
|
|
21 |
To run with a specific environment::
|
|
22 |
|
|
23 |
result = procrunner.run(..., environment={ 'VARIABLE': 'value' })
|