summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2023-12-29 10:01:18 +0200
committerLars Wirzenius <liw@liw.fi>2023-12-29 10:01:18 +0200
commitff95f6258856efeb525da0a87944e8324ad4d1d3 (patch)
tree9e2bf33b8ecfd2126dca1c161774799a6284443e
parent3e560c049b4113c3f3ee69c0676ece2df4ce0d2d (diff)
downloadwumpus-hunter-ff95f6258856efeb525da0a87944e8324ad4d1d3.tar.gz
feat: --keep option
Signed-off-by: Lars Wirzenius <liw@liw.fi>
-rwxr-xr-xwumpus-hunter10
1 files changed, 8 insertions, 2 deletions
diff --git a/wumpus-hunter b/wumpus-hunter
index 866c15d..fc2f111 100755
--- a/wumpus-hunter
+++ b/wumpus-hunter
@@ -56,6 +56,9 @@ def parse_args():
help="Count statistics per commit to file",
required=True,
)
+ p.add_argument(
+ "--keep", action="store_true", help="Keep log file of successful run"
+ )
return p.parse_args()
@@ -135,7 +138,7 @@ def run(argv, cwd=None):
log_output("stderr", p.stderr)
logging.info(f"exit code {p.returncode}")
if p.returncode != 0:
- return Exception(f"command {argv} failed")
+ raise Exception(f"command {argv} failed")
return p.stdout.decode()
@@ -235,7 +238,10 @@ def main():
build(args.dir)
run_tests(args.dir, args.test)
record_success(args.stats, commit)
- remove_log(args.log)
+ if args.keep:
+ rename_log(args.log, args.run_log, commit)
+ else:
+ remove_log(args.log)
except Exception as e:
logging.error(f"{e}", exc_info=True)
record_failure(args.stats, commit)