Skip to content

Commit

Permalink
Prepend build status to log files
Browse files Browse the repository at this point in the history
  • Loading branch information
lplarson committed Apr 25, 2017
1 parent 1e3d2ac commit 5b06ffc
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions project.py
Original file line number Diff line number Diff line change
Expand Up @@ -678,21 +678,26 @@ def build(self, stdout=sys.stdout):
results = self.new_result()
for subtarget in self.subtargets():
if self.included(subtarget):
output_fd = self.output_fd(subtarget)
(log_filename, output_fd) = self.output_fd(subtarget)
try:
results.add(self.subbuilder(*self.attach(subtarget)).build(
stdout=output_fd
))
finally:
if output_fd is not sys.stdout:
output_fd.close()
os.rename(
log_filename,
'%s_%s' % (results, log_filename),
)

return results

def new_result(self):
return ListResult()

def output_fd(self, subtarget):
return sys.stdout
return (None, sys.stdout)


class ProjectListBuilder(ListBuilder):
Expand Down Expand Up @@ -735,7 +740,7 @@ def output_fd(self, subtarget):
fd = sys.stdout
else:
fd = open(log_filename, 'w')
return fd
return (log_filename, fd)



Expand Down

0 comments on commit 5b06ffc

Please sign in to comment.