A fast subprocess library
Project description
Fastprocess
A fast subprocess library
Usage
Spawning a process with fastprocess is very easy
In [1]: from fastprocess import FastProcess
In [2]: pid = FastProcess(['echo', 'hello', 'world'])
hello world
In [3]: pid.wait()
Out[3]: 0
You can redirect io using the stdin, stdout, and stderr options
In [4]: null = open('/dev/null', 'w')
In [5]: pid = FastProcess(['yes'], stdout=null)
In [6]: pid.terminate()
Fp methods
terminate():
Sends SIGTERM to the process
kill(sig):
Sends signal 'sig' to the process
wait():
Waits for the process to exit then returns the exit code
Performance
Here are the results of running ./benchmark/bench
---------------------------------------
10000 spawns with fork and exec...
real 0m2.214s
user 0m0.083s
sys 0m2.123s
---------------------------------------
10000 spawns with fastprocess...
real 0m3.163s
user 0m0.383s
sys 0m2.772s
---------------------------------------
10000 spawns with subprocess...
real 0m11.110s
user 0m6.773s
sys 0m7.772s
---------------------------------------
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
fastprocess-0.1.0.tar.gz
(1.9 kB
view hashes)
Built Distribution
Close
Hashes for fastprocess-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aa7f067061d428de64061dad94969a36b962eb75acec9415347e7c20e49238da |
|
MD5 | 39d13bc947972bd7efedb4c9e99174d3 |
|
BLAKE2b-256 | dc0e94c3121ab54ef059bf3249f36b944e516e8084edfbfd8b31005bac9769be |