CMS 3D CMS Logo

pipe.py
Go to the documentation of this file.
1 import shlex as _shlex
2 import subprocess as _subprocess
3 
4 
5 def pipe(cmdline, input = None):
6  """
7  wrapper around subprocess to simplify te interface
8  """
9  args = _shlex.split(cmdline)
10  if input is not None:
11  command = _subprocess.Popen(args, stdin = _subprocess.PIPE, stdout = _subprocess.PIPE, stderr = None)
12  else:
13  command = _subprocess.Popen(args, stdin = None, stdout = _subprocess.PIPE, stderr = None)
14  (out, err) = command.communicate(input)
15  return out
def pipe(cmdline, input=None)
Definition: pipe.py:5