20 lines
353 B
Python
Executable file
20 lines
353 B
Python
Executable file
#!/usr/bin/env python
|
|
|
|
import sys
|
|
import re
|
|
|
|
if len(sys.argv) != 2:
|
|
sys.stderr.write("Please specify a file path\n")
|
|
exit(2)
|
|
|
|
try:
|
|
my_file = open(sys.argv[1], mode='r')
|
|
text = my_file.read()
|
|
my_file.close()
|
|
except UnicodeDecodeError:
|
|
exit(0)
|
|
|
|
if re.search(r"expect\s+(?:runtime\s+)?\berror", text):
|
|
exit(0)
|
|
else:
|
|
exit(1)
|