@@ -50,9 +50,10 @@ def main():
5050
5151 scanned_result = []
5252 license_list = []
53+ time_out = 120
5354
5455 try :
55- opts , args = getopt .getopt (argv , 'hvmjs:p:o:f:' )
56+ opts , args = getopt .getopt (argv , 'hvmjs:p:o:f:t: ' )
5657 for opt , arg in opts :
5758 if opt == "-h" :
5859 print_help_msg_source ()
@@ -70,6 +71,8 @@ def main():
7071 format = arg
7172 elif opt == "-s" :
7273 selected_scanner = arg .lower ()
74+ elif opt == "-t" :
75+ time_out = arg
7376 except Exception :
7477 print_help_msg_source ()
7578
@@ -90,13 +93,15 @@ def main():
9093 if selected_scanner == 'scancode' :
9194 success , _result_log ["Scan Result" ], scanned_result , license_list = run_scan (path_to_scan , output_file_name ,
9295 write_json_file , - 1 , True ,
93- print_matched_text , format , True )
96+ print_matched_text , format , True ,
97+ time_out )
9498 elif selected_scanner == 'scanoss' :
9599 scanned_result = run_scanoss_py (path_to_scan , output_file_name , format , True , write_json_file )
96100 elif selected_scanner == 'all' or selected_scanner == '' :
97101 success , _result_log ["Scan Result" ], scanned_result , license_list = run_all_scanners (path_to_scan , output_file_name ,
98102 write_json_file , - 1 ,
99- print_matched_text , format , True )
103+ print_matched_text , format , True ,
104+ time_out )
100105 else :
101106 print_help_msg_source ()
102107 sys .exit (1 )
@@ -167,7 +172,7 @@ def create_report_file(start_time, scanned_result, license_list, selected_scanne
167172
168173
169174def run_all_scanners (path_to_scan , output_file_name = "" , _write_json_file = False , num_cores = - 1 ,
170- need_license = False , format = "" , called_by_cli = True ):
175+ need_license = False , format = "" , called_by_cli = True , time_out = 120 ):
171176 """
172177 Run Scancode and scanoss.py for the given path.
173178
@@ -192,7 +197,7 @@ def run_all_scanners(path_to_scan, output_file_name="", _write_json_file=False,
192197 success , _result_log ["Scan Result" ], scancode_result , license_list = run_scan (path_to_scan , output_file_name ,
193198 _write_json_file , num_cores ,
194199 True , need_license ,
195- format , called_by_cli )
200+ format , called_by_cli , time_out )
196201 scanoss_result = run_scanoss_py (path_to_scan , output_file_name , format , called_by_cli , _write_json_file )
197202
198203 for file_in_scancode_result in scancode_result :
0 commit comments