mirror of
https://github.com/rizsotto/scan-build.git
synced 2025-12-16 12:00:08 +01:00
simplify JSON read/write on libscanbuild side
This commit is contained in:
@@ -161,10 +161,9 @@ def write_exec_trace(filename, entry):
|
|||||||
:param filename: path to the output execution trace file,
|
:param filename: path to the output execution trace file,
|
||||||
:param entry: the Execution object to append to that file. """
|
:param entry: the Execution object to append to that file. """
|
||||||
|
|
||||||
|
call = {'pid': entry.pid, 'cwd': entry.cwd, 'cmd': entry.cmd}
|
||||||
with open(filename, 'w') as handler:
|
with open(filename, 'w') as handler:
|
||||||
call = {'pid': entry.pid, 'cwd': entry.cwd, 'cmd': entry.cmd}
|
json.dump(call, handler)
|
||||||
line = json.dumps(call)
|
|
||||||
handler.write(line)
|
|
||||||
|
|
||||||
|
|
||||||
def parse_exec_trace(filename):
|
def parse_exec_trace(filename):
|
||||||
@@ -178,12 +177,11 @@ def parse_exec_trace(filename):
|
|||||||
|
|
||||||
logging.debug(filename)
|
logging.debug(filename)
|
||||||
with open(filename, 'r') as handler:
|
with open(filename, 'r') as handler:
|
||||||
for line in handler:
|
entry = json.load(handler)
|
||||||
entry = json.loads(line.strip())
|
return Execution(
|
||||||
return Execution(
|
pid=entry['pid'],
|
||||||
pid=entry['pid'],
|
cwd=entry['cwd'],
|
||||||
cwd=entry['cwd'],
|
cmd=entry['cmd'])
|
||||||
cmd=entry['cmd'])
|
|
||||||
|
|
||||||
|
|
||||||
def exec_trace_files(directory):
|
def exec_trace_files(directory):
|
||||||
|
|||||||
Reference in New Issue
Block a user