Skip to content

Commit

Permalink
Refactor checking for substring in output
Browse files Browse the repository at this point in the history
  • Loading branch information
pyoor committed Nov 12, 2024
1 parent abd75e5 commit 09ca1d1
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/lithium/interestingness/outputs.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,11 +72,10 @@ def interesting(
run_info = timed_run(args.cmd_with_flags, args.timeout, temp_prefix)

if temp_prefix is None:
outputs = (run_info.out, run_info.err)
for data in outputs:
if (args.regex and re.match(args.search, data, flags=re.MULTILINE)) or (
args.search.encode("utf-8") in data
):
encoded = args.search.encode("utf-8")
match = encoded if args.regex else re.escape(encoded)
for data in (run_info.out, run_info.err):
if re.search(match, data, flags=re.MULTILINE):
LOG.info("[Interesting] Match detected!")
return True

Expand Down

0 comments on commit 09ca1d1

Please sign in to comment.