Catch timeout errors
This commit is contained in:
parent
c52a06c09c
commit
415757535e
15
runall.py
15
runall.py
|
@ -5,6 +5,7 @@ chars = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ!"#$%&\'(
|
|||
|
||||
|
||||
def check_pair(script, instr, outstr):
|
||||
try:
|
||||
result = subprocess.run(
|
||||
[
|
||||
"/usr/bin/env", "bash", "-c",
|
||||
|
@ -19,6 +20,8 @@ def check_pair(script, instr, outstr):
|
|||
capture_output=True,
|
||||
)
|
||||
return result.returncode == 0 and result.stdout == outstr.encode()
|
||||
except subprocess.TimeoutExpired:
|
||||
return False
|
||||
|
||||
|
||||
def check_pairs(script, pairs):
|
||||
|
@ -60,9 +63,9 @@ if __name__ == '__main__':
|
|||
), max_length=3)
|
||||
|
||||
# Successor
|
||||
print("\nSearching for successor")
|
||||
find_script((
|
||||
("1", "2"),
|
||||
("2", "3"),
|
||||
("3", "4"),
|
||||
), max_length=5)
|
||||
# print("\nSearching for successor")
|
||||
# find_script((
|
||||
# ("1", "2"),
|
||||
# ("2", "3"),
|
||||
# ("3", "4"),
|
||||
# ), max_length=5)
|
||||
|
|
Loading…
Reference in New Issue