Add flag to dump project info output to file

Review Request #998 - Created Sept. 5, 2014 and submitted

Information
Tejal Desai
pants
https://github.com/pantsbuild/intellij-pants-plugin/issues/5
1718ab9...
Reviewers
pants-reviews
fkorotkov, zundel

Add flag to dump project info output to file.

This file option will be used in intellij plugin.

https://travis-ci.org/pantsbuild/pants/builds/34542731

This is OS Pants review for https://github.com/pantsbuild/intellij-pants-plugin/issues/5

Issues

  • 0
  • 2
  • 0
  • 2
Description From Last Updated
Fedor Korotkov
Tejal Desai
Tejal Desai
Eric Ayers
Tejal Desai
Eric Ayers
Tejal Desai
Eric Ayers
Tejal Desai
Tejal Desai
Review request changed

Status: Closed (submitted)

John Sirois

   

The non-local close could be improved with another contextmanager - its always best to see open/close paired locally in the narrowest scope. Right now - what happens if pants constructs the task but fails before executing it?

Imagine:

@contextmanager
def _outstream(self):
  if self.context.options.console_outstream:
    with safe_open(os.path.abspath(self.context.options.console_outstream), 'w') as out:
      yield out
  else:
    try:
      yield self.context.console_outstream
    finally:
      self.context.console_outstream.flush()

def execute(self):
  with self._guard_sigpipe():
    with self._outstream() as out:
      targets = self.context.targets()
      for value in self.console_output(targets):
        out.write(str(value))
        out.write(self._console_separator)
  1. yes this approach is better.

    Thanks. will add this in a another rb.

Loading...