https://github.com/arusso/piper
Easy to use library for running shell lines via the subprocess.Popen and getting the output
https://github.com/arusso/piper
Last synced: 14 days ago
JSON representation
Easy to use library for running shell lines via the subprocess.Popen and getting the output
- Host: GitHub
- URL: https://github.com/arusso/piper
- Owner: arusso
- Created: 2012-02-11T00:22:05.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2012-03-29T22:20:50.000Z (over 14 years ago)
- Last Synced: 2025-02-05T22:57:23.025Z (over 1 year ago)
- Language: Python
- Homepage:
- Size: 89.8 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
README
Piper README
============
Piper is a simple library for python that allows you to easily executed piped
shell statements, and retrieve the output.
Actually, it doesn't do much but generate the Popen() statements for you, link
the stdin/stdout and return the output for you.
As an example, the following statements are all equivalent:
Examples
--------
Shell:
$ lsof -T | grep inode | cut -d ' ' -f 1 | sort -u
Python:
p1=Popen(['lsof','T'],stdout=PIPE)
p2=Popen(['grep','inode'],stdin=p1.stdout,stdout=PIPE)
p3=Popen(['cut','-d',' ','-f','1'],stdin=p2.stdout,stdout=PIPE)
p4=Popen(['sort','-u'],stdin=p3.stdout,stdout=PIPE)
print p4.communicate()[0],
Python w/Piper:
p=Piper()
print p.run("lsof -T | grep inode | cut -d ' ' -f 1 | sort -u")