1
0
mirror of https://github.com/kellyjonbrazil/jc.git synced 2025-06-19 00:17:51 +02:00

raise for non-stat data

This commit is contained in:
Kelly Brazil
2022-01-05 07:46:58 -08:00
parent 0b6a130779
commit 7b22fa81de

View File

@ -233,9 +233,17 @@ def parse(data, raw=False, quiet=False, ignore_exceptions=False):
output_line['birth_time'] = line_list[1] output_line['birth_time'] = line_list[1]
continue continue
# catch non-stat data
if not line.startswith(' File: '):
raise ParseError('Not stat data')
# FreeBSD/OSX output # FreeBSD/OSX output
if os_type != 'linux': if os_type != 'linux':
value = shlex.split(line) value = shlex.split(line)
if not value[1].isdigit():
raise ParseError('Not stat data')
output_line = { output_line = {
'file': ' '.join(value[15:]), 'file': ' '.join(value[15:]),
'unix_device': value[0], 'unix_device': value[0],