A fast subprocess library
Project description
WARNING: This library requires python 3.8
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()
FastProcess 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-1.0.0.tar.gz
(2.4 kB
view hashes)
Built Distribution
Close
Hashes for fastprocess-1.0.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b51317f34540be3c248e23e85078465f4d46911ced98f4107f21fdb019dee9c |
|
MD5 | 7d7f7126c921f83c537a1e0b5cb93356 |
|
BLAKE2b-256 | ff0e318c4a3bb84fccdf9067fa17dfa615d642b0f404e02312269402f811bf1c |