Skip to content

Commit

Permalink
whatever Mike
Browse files Browse the repository at this point in the history
  • Loading branch information
Dylan Stephano-Shachter committed Jan 18, 2019
1 parent ee002f2 commit af01c90
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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()
```
Expand Down
4 changes: 2 additions & 2 deletions benchmark/fptest.py
Original file line number Diff line number Diff line change
@@ -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')))
2 changes: 1 addition & 1 deletion fastprocess/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
from fastprocess.fp import Fp
from fastprocess.fastprocess import FastProcess
2 changes: 1 addition & 1 deletion fastprocess/fp.py → fastprocess/fastprocess.py
Original file line number Diff line number Diff line change
@@ -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:
Expand Down

0 comments on commit af01c90

Please sign in to comment.