Skip to content

Commit ded1c86

Browse files
committed
Return the parsed result
1 parent 003ba4c commit ded1c86

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

src/fosslight_source/run_scancode.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ def run_scan(path_to_scan, output_file_name="",
6767
msg = ""
6868
_str_final_result_log = ""
6969
_result_log = {}
70-
results = {}
70+
result_list = []
7171

7272
_windows = platform.system() == "Windows"
7373
start_time = datetime.now().strftime('%Y-%m-%d_%H-%M-%S')
@@ -130,7 +130,7 @@ def run_scan(path_to_scan, output_file_name="",
130130
msg = _ERROR_PREFIX+"Check the path to scan. :" + path_to_scan+"\n"
131131

132132
if not return_results:
133-
results = {}
133+
result_list = []
134134
scan_result_msg = str(success)+" "+msg
135135
_result_log["Scan Result"] = scan_result_msg.strip()
136136
_result_log["Output Directory"] = output_dir
@@ -139,7 +139,7 @@ def run_scan(path_to_scan, output_file_name="",
139139
logger.warn("\n"+_str_final_result_log)
140140
except Exception as ex:
141141
logger.warn(_ERROR_PREFIX+"Failed to print result log. "+ str(ex))
142-
return success, _str_final_result_log, results
142+
return success, _str_final_result_log, result_list
143143

144144

145145
if __name__ == '__main__':

test/cli_test.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,11 @@ def main():
3535
logger.warn("[Scan] Result_msg: %s" % (ret[1]))
3636

3737
if len(ret) > 2:
38-
logger.warn("[Scan] Result_items: %s" % (str(ret[2])))
38+
try:
39+
for scan_item in ret[2]:
40+
logger.warn(scan_item.get_row_to_print())
41+
except Exception as ex:
42+
logger.error("Error:"+str(ex))
3943

4044

4145
if __name__ == '__main__':

0 commit comments

Comments
 (0)