dummynet.RunInfo
¶
- class dummynet.RunInfo(cmd, cwd, pid, stdout, stderr, returncode, is_async, is_daemon, timeout)¶
Stores the results from running a command
- Variables:
cmd – see
RunInfo.__init__()
cwd – see
RunInfo.__init__()
pid – see
RunInfo.__init__()
stdout – see
RunInfo.__init__()
stderr – see
RunInfo.__init__()
returncode – see
RunInfo.__init__()
is_async – see
RunInfo.__init__()
is_daemon – see
RunInfo.__init__()
timeout – see
RunInfo.__init__()
stdout_callback – The callback to be called when the standard output stream is received (default: None). The callback should accept a single argument which is the data received.
stderr_callback – The callback to be called when the standard error stream is received (default: None). The callback should accept a single argument which is the data received.
- __init__(cmd, cwd, pid, stdout, stderr, returncode, is_async, is_daemon, timeout)¶
Create a new object
- Parameters:
cmd – The command that was executed
cwd – Current working directory i.e. path where the command was executed
pid – The process ID of the command
stdout – The standard output stream generated by the command
stderr – The standard error stream generated by the command
returncode – The return code set after invoking the command
is_async – Whether the command was run asynchronously
is_daemon – Whether the command was run as a daemon
timeout – The timeout in seconds, if None then no timeout
- match(stdout=None, stderr=None)¶
Matches the lines in the output with the pattern. The match pattern can contain basic wildcards, see https://docs.python.org/2/library/fnmatch.html For convenience:
+-----------------------------------------+ |Pattern|Meaning | +-----------------------------------------+ |* |matches everything | +-----------------------------------------+ |? |matches any single character | +-----------------------------------------+ |[seq] |matches any character in seq | +-----------------------------------------+ |[!seq] |matches any character not in seq | +-----------------------------------------+
Simple example:
out.match(stdout='*success*')
- Parameters:
stdout – Pattern to search for in the list of stdout string
stderr – Pattern to search for in the list of stderr string
- Raises:
MatchError – If the pattern is not found in the output