Package svnmailer :: Module processes :: Class Process
[show private | hide private]
[frames | no frames]

Class Process

object --+
         |
        Process


Spawn a child with certain attributes
Method Summary
  __init__(self, cmd, pstdin, pstdout, pstderr, detach)
Initialization
Process detach(cls, command)
Returns the process object of a detached process (Class method)
Process pipe2(cls, command)
Returns the process object of a piped process (Class method)
Process pipe4(cls, command)
Returns the process object of a piped process (Class method)
int wait(self)
Waits for the process to end
str or list _escapecmd(self, command, winshell)
Return the revised command suitable for being exec'd
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name...
  __getattribute__(...)
x.__getattribute__('name') <==> x.name...
  __hash__(x)
x.__hash__() <==> hash(x)...
  __reduce__(...)
helper for pickle...
  __reduce_ex__(...)
helper for pickle...
  __repr__(x)
x.__repr__() <==> repr(x)...
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value...
  __str__(x)
x.__str__() <==> str(x)...
    Inherited from type
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T...

Instance Variable Summary
file fromchild: pipe from the child
file tochild: pipe to the child
ProcessImpl _impl: The ProcessImpl instance

Class Variable Summary
str IMPLEMENTATION: A token describing the chosen implementation.
type or ClassType _IMPLEMENTATION_CLASS = svnmailer.processes.ProcessImpl
_sre.SRE_Pattern _SLASHRE: The substitution regex for backslashes (Win32 only)
_sre.SRE_Pattern _TOKENRE: The search regex for quotable tokens (Win32 only)

Instance Method Details

__init__(self, cmd, pstdin=False, pstdout=False, pstderr=False, detach=False)
(Constructor)

Initialization
Parameters:
cmd - The command to execute (type must be suitable for the platform)
           (type=list or basestring)
pstdin - Pipe to stdin?
           (type=bool)
pstdout - Pipe from stdout?
           (type=bool)
pstderr - Pipe from stderr (on stdout channel)
           (type=bool)
detach - Detach the process? (evauluated on Win32 only)
           (type=bool)
Raises:
NotImplementedError - not implemented functions were activated
Overrides:
__builtin__.object.__init__

wait(self)

Waits for the process to end
Returns:
The exit status of the process
           (type=int)

Note: The implementation may define a dummy wait call. The actual waiting happens when the last pipe handle is closed then. This happens if the dumb implementation is used.

_escapecmd(self, command, winshell=True)

Return the revised command suitable for being exec'd

Currently this means, it's escaped and converted to a string only for Win32, because on this system no list based exec is available. For other systems the list is just returned.

Parameters:
command - The command to escape
           (type=list)
winshell - Use shell on windows (cmd.exe)?
           (type=bool)
Returns:
The escaped command string or the original list
           (type=str or list)

Class Method Details

detach(cls, command)

Returns the process object of a detached process

The function spawns a command detached from the current one. All std-handles are inherited (no pipe is opened).

Parameters:
command - The command list (the first item is the command itself, the rest represents the arguments)
           (type=list)
Returns:
The process object
           (type=Process)
Raises:
NotImplementedError - Detaching this way is not implemented on this platform

pipe2(cls, command)

Returns the process object of a piped process

The function spawns a command and opens two pipes. One pipe is for writing to command's stdin and the other one is for reading stdout. stderr is inherited from the caller.

Parameters:
command - The command list (the first item is the command itself, the rest represents the arguments)
           (type=list)
Returns:
The process object
           (type=Process)

pipe4(cls, command)

Returns the process object of a piped process

The function spawns a command and opens two pipes. One pipe is for writing to command's stdin and the other one is for reading stdout + stderr (together)

Parameters:
command - The command list (the first item is the command itself, the rest represents the arguments)
           (type=list)
Returns:
The process object
           (type=Process)

Instance Variable Details

fromchild

pipe from the child
Type:
file

tochild

pipe to the child
Type:
file

_impl

The ProcessImpl instance
Type:
ProcessImpl

Class Variable Details

IMPLEMENTATION

A token describing the chosen implementation. Possible tokens are: subprocess, popen, win32api, dumb
Type:
str
Value:
'popen'                                                                

_SLASHRE

The substitution regex for backslashes (Win32 only)
Type:
_sre.SRE_Pattern

_TOKENRE

The search regex for quotable tokens (Win32 only)
Type:
_sre.SRE_Pattern

Generated by Epydoc 2.0 on Sun Sep 25 20:49:05 2005 http://epydoc.sf.net