~martijnbraam/almobootstrap

09870a46a0892e29b54eee7419046186d42504c1 — Newbyte 8 months ago d31313f
pmb.helpers.frontend: Also clear testsuite log when running log -c

Reviewed-by: Oliver Smith <ollieparanoid@postmarketos.org>
Link: https://lists.sr.ht/~postmarketos/pmbootstrap-devel/%3C20230603102910.164433-1-newbyte@postmarketos.org%3E
1 files changed, 3 insertions(+), 1 deletions(-)

M pmb/helpers/frontend.py
M pmb/helpers/frontend.py => pmb/helpers/frontend.py +3 -1
@@ 531,14 531,16 @@ def work_migrate(args):


def log(args):
    log_testsuite = f"{args.work}/log_testsuite.txt"

    if args.clear_log:
        pmb.helpers.run.user(args, ["truncate", "-s", "0", args.log])
        pmb.helpers.run.user(args, ["truncate", "-s", "0", log_testsuite])

    cmd = ["tail", "-n", args.lines, "-F"]

    # Follow the testsuite's log file too if it exists. It will be created when
    # starting a test case that writes to it (git -C test grep log_testsuite).
    log_testsuite = f"{args.work}/log_testsuite.txt"
    if os.path.exists(log_testsuite):
        cmd += [log_testsuite]