An open API service indexing awesome lists of open source software.

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

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")