Skip to content

arusso/piper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 

Repository files navigation

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

About

Easy to use library for running shell lines via the subprocess.Popen and getting the output

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages