(command, cwd, logfile=None, tail_lines=10, tee=False, live=False, shell=None, capture_output=False)
| 1449 | print("Tailing last %d lines of file %s" % (lines, file)) |
| 1450 | print(''.join(data[-lines:])) |
| 1451 | break |
| 1452 | |
| 1453 | |
| 1454 | def run_with_log_tail(command, cwd, logfile=None, tail_lines=10, tee=False, live=False, shell=None, capture_output=False): |
| 1455 | fh = sys.stdout |
| 1456 | if logfile: |
| 1457 | logdir = os.path.dirname(logfile) |
| 1458 | if not os.path.exists(logdir): |
| 1459 | os.makedirs(logdir) |
| 1460 | fh = open(logfile, 'w') |
| 1461 | |
| 1462 | rc, captured_output = run_follow(command, cwd, fh=fh, tee=tee, live=live, shell=shell, capture_output=capture_output) |
| 1463 | |
| 1464 | if logfile: |
| 1465 | fh.close() |
| 1466 | if not tee and tail_lines and tail_lines > 0: |
| 1467 | tail_file(logfile, tail_lines) |
| 1468 | |
| 1469 | return rc, captured_output |
no test coverage detected
searching dependent graphs…