From af01c90686284b69abfe86ede5ad7b19b42a6361 Mon Sep 17 00:00:00 2001 From: Dylan Stephano-Shachter Date: Fri, 18 Jan 2019 14:38:26 -0500 Subject: [PATCH] whatever Mike --- README.md | 10 +++++----- benchmark/fptest.py | 4 ++-- fastprocess/__init__.py | 2 +- fastprocess/{fp.py => fastprocess.py} | 2 +- 4 files changed, 9 insertions(+), 9 deletions(-) rename fastprocess/{fp.py => fastprocess.py} (97%) diff --git a/README.md b/README.md index c4542a5..7f82ae2 100644 --- a/README.md +++ b/README.md @@ -4,20 +4,20 @@ A fast subprocess library ## Usage Spawning a process with fastprocess is very easy ``` -In [1]: from fastprocess import Fp +In [1]: from fastprocess import FastProcess -In [2]: pid = Fp(['echo', 'hello', 'world']) +In [2]: pid = FastProcess(['echo', 'hello', 'world']) hello world -In [3]: pid.wait() +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 [4]: null = open('/dev/null', 'w') -In [5]: pid = Fp(['yes'], stdout=null) +In [5]: pid = FastProcess(['yes'], stdout=null) In [6]: pid.terminate() ``` diff --git a/benchmark/fptest.py b/benchmark/fptest.py index 33e061d..e7ac3d9 100755 --- a/benchmark/fptest.py +++ b/benchmark/fptest.py @@ -1,8 +1,8 @@ #!/usr/bin/python3 -from fastprocess import Fp +from fastprocess import FastProcess procs = [] for i in range(10000): - procs.append(Fp(['echo', 'hello', 'world'], stdout=open('/dev/null', 'w'))) + procs.append(FastProcess(['echo', 'hello', 'world'], stdout=open('/dev/null', 'w'))) diff --git a/fastprocess/__init__.py b/fastprocess/__init__.py index 0398232..3ee40af 100644 --- a/fastprocess/__init__.py +++ b/fastprocess/__init__.py @@ -1 +1 @@ -from fastprocess.fp import Fp +from fastprocess.fastprocess import FastProcess diff --git a/fastprocess/fp.py b/fastprocess/fastprocess.py similarity index 97% rename from fastprocess/fp.py rename to fastprocess/fastprocess.py index 5224d01..d075261 100644 --- a/fastprocess/fp.py +++ b/fastprocess/fastprocess.py @@ -1,7 +1,7 @@ import os import signal -class Fp: +class FastProcess: def __init__(self, cmd, stdin=None, stdout=None, stderr=None): self.pid = os.fork() if self.pid == 0: