Ejemplo n.º 1
0
def main():
  exiter = Exiter()
  exiter.set_except_hook()

  try:
    LocalPantsRunner(exiter).run()
  except KeyboardInterrupt:
    exiter.exit_and_fail('Interrupted by user.')
Ejemplo n.º 2
0
 def test_log_exception(self):
   with temporary_dir() as workdir:
     exiter = Exiter()
     exiter.apply_options(create_options({ '': {
       'print_exception_stacktrace': True,
       'pants_workdir': workdir}
     }))
     exiter._log_exception('test-data')
     output_path = os.path.join(workdir, 'logs', 'exceptions.log')
     self.assertTrue(os.path.exists(output_path))
     with open(output_path, 'r') as exception_log:
       timestamp = exception_log.readline()
       args = exception_log.readline()
       pid = exception_log.readline()
       msg = exception_log.readline()
       self.assertIn('timestamp: ', timestamp)
       self.assertIn('args: [', args)
       self.assertIn('pid: {}'.format(os.getpid()), pid)
       self.assertIn('test-data', msg)
Ejemplo n.º 3
0
def main():
    exiter = Exiter()
    exiter.set_except_hook()

    try:
        PantsRunner(exiter).run()
    except KeyboardInterrupt:
        exiter.exit_and_fail(b'Interrupted by user.')
Ejemplo n.º 4
0
 def test_log_exception(self):
     with temporary_dir() as workdir:
         exiter = Exiter()
         exiter.apply_options(
             create_options({
                 '': {
                     'print_exception_stacktrace': True,
                     'pants_workdir': workdir
                 }
             }))
         exiter._log_exception('test-data')
         output_path = os.path.join(workdir, 'logs', 'exceptions.log')
         self.assertTrue(os.path.exists(output_path))
         with open(output_path, 'r') as exception_log:
             timestamp = exception_log.readline()
             args = exception_log.readline()
             pid = exception_log.readline()
             msg = exception_log.readline()
             self.assertIn('timestamp: ', timestamp)
             self.assertIn('args: [', args)
             self.assertIn('pid: {}'.format(os.getpid()), pid)
             self.assertIn('test-data', msg)