Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions scripts/run_fuzzer.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,9 +95,12 @@ def get_fuzzer_name_printable(fuzzer):
return 'Unknown'


def run_shell_command(cmd):
def run_shell_command(cmd, timeout=300):
command = [shell, '--batch', '-init', '/dev/null']
res = subprocess.run(command, input=bytearray(cmd, 'utf8'), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
try:
res = subprocess.run(command, input=bytearray(cmd, 'utf8'), stdout=subprocess.PIPE, stderr=subprocess.PIPE, timeout=timeout)
except subprocess.TimeoutExpired:
return ("", f"query timed out after {timeout} seconds", -1)
stdout = res.stdout.decode('utf8', 'ignore').strip()
stderr = res.stderr.decode('utf8', 'ignore').strip()
return (stdout, stderr, res.returncode)
Expand Down
Loading