Changeset 98 for branches/mk/cheesecake/util.py
- Timestamp:
- 07/21/06 10:04:44 (7 years ago)
- Files:
-
- branches/mk/cheesecake/util.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
branches/mk/cheesecake/util.py
r78 r98 12 12 def run_cmd(cmd, env=None): 13 13 """Run command and return its return code and its output. 14 15 >>> run_cmd('/bin/true') 16 (0, '') 14 17 """ 15 18 arglist = cmd.split() … … 23 26 def command_successful(cmd): 24 27 """Returns True if command exited normally, False otherwise. 28 29 >>> command_successful('/bin/true') 30 True 31 >>> command_successful('this-command-doesnt-exist') 32 False 25 33 """ 26 34 rc, output = run_cmd(cmd) … … 30 38 31 39 class StdoutRedirector(object): 40 """Redirect stdout to a temporary file. 32 41 """ 33 Redirect stdout to a temp file34 """35 36 42 def __init__(self, filename=None): 37 43 if filename: … … 47 53 48 54 def read_buffer(self): 49 """ 50 Return contents of the temp file 55 """Return contents of the temporary file. 51 56 """ 52 57 self.fh.seek(0) … … 54 59 55 60 def pad_with_dots(msg, length=PAD_TEXT): 56 """ 57 Pad text with dots up to given length 61 """Pad text with dots up to given length. 58 62 """ 59 63 length = len(msg)
