CMS 3D CMS Logo

/data/refman/pasoursint/CMSSW_4_1_8_patch9/src/HLTrigger/Configuration/python/Tools/pipe.py

Go to the documentation of this file.
00001 import shlex as _shlex
00002 import subprocess as _subprocess
00003 
00004 
00005 def pipe(cmdline, input = None):
00006   """
00007   wrapper around subprocess to simplify te interface
00008   """
00009   args = _shlex.split(cmdline)
00010   if input is not None:
00011     command = _subprocess.Popen(args, stdin = _subprocess.PIPE, stdout = _subprocess.PIPE, stderr = None)
00012   else:
00013     command = _subprocess.Popen(args, stdin = None, stdout = _subprocess.PIPE, stderr = None)
00014   (out, err) = command.communicate(input)
00015   return out