Back to index

moin  1.9.0~rc2
Classes | Functions
MoinMoin.util.SubProcess Namespace Reference

Classes

class  Popen

Functions

def exec_cmd

Detailed Description

Enhanced subprocess.Popen subclass, supporting:
    * .communicate() with timeout
    * kill/terminate/send_signal (like in Py 2.6) for Py 2.4 / 2.5

Sample usage:
    out, err = Popen(...).communicate(input, timeout=300)

Function Documentation

def MoinMoin.util.SubProcess.exec_cmd (   cmd,
  input = None,
  timeout = None 
)

Definition at line 230 of file SubProcess.py.

00230 
00231 def exec_cmd(cmd, input=None, timeout=None):
00232     p = Popen(cmd, shell=True,
00233               close_fds=not subprocess.mswindows,
00234               bufsize=1024,
00235               stdin=subprocess.PIPE,
00236               stdout=subprocess.PIPE,
00237               stderr=subprocess.PIPE)
00238     data, errors = p.communicate(input, timeout=timeout)
00239     return data, errors, p.returncode
00240 

Here is the caller graph for this function: