diff options
-rw-r--r-- | bitbake/lib/bb/build.py | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/bitbake/lib/bb/build.py b/bitbake/lib/bb/build.py index e4e767ebc1..3138fbc166 100644 --- a/bitbake/lib/bb/build.py +++ b/bitbake/lib/bb/build.py | |||
@@ -103,13 +103,27 @@ class TaskInvalid(TaskBase): | |||
103 | self._message = "No such task '%s'" % task | 103 | self._message = "No such task '%s'" % task |
104 | 104 | ||
105 | 105 | ||
106 | class tee(file): | 106 | class LogTee(object): |
107 | def __init__(self, logger, *files): | ||
108 | self.files = files | ||
109 | self.logger = logger | ||
110 | |||
107 | def write(self, string): | 111 | def write(self, string): |
108 | logger.plain(string) | 112 | self.logger.plain(string) |
109 | file.write(self, string) | 113 | for f in self.files: |
114 | f.write(string) | ||
115 | |||
116 | def __enter__(self): | ||
117 | for f in self.files: | ||
118 | f.__enter__() | ||
119 | return self | ||
120 | |||
121 | def __exit__(self, *excinfo): | ||
122 | for f in self.files: | ||
123 | f.__exit__(*excinfo) | ||
110 | 124 | ||
111 | def __repr__(self): | 125 | def __repr__(self): |
112 | return "<open[tee] file '{0}'>".format(self.name) | 126 | return '<LogTee {0}>'.format(', '.join(repr(f.name) for f in self.files)) |
113 | 127 | ||
114 | 128 | ||
115 | def exec_func(func, d, dirs = None, logfile = NULL): | 129 | def exec_func(func, d, dirs = None, logfile = NULL): |