@@ -449,32 +449,44 @@ def find_board():
449449 try :
450450 output = subprocess .check_output (
451451 [arduino_cli , "board" , "listall" , "--format" , "json" ],
452- stderr = subprocess .DEVNULL ,
452+ stderr = subprocess .STDOUT ,
453453 ).decode ("utf-8" )
454+ except subprocess .CalledProcessError as e :
455+ print ('"' + " " .join (e .cmd ) + '" failed with code: {}!' .format (e .returncode ))
456+ print (e .stdout )
457+ quit (e .returncode )
458+ else :
454459 boards_list = json .loads (output )
455460 if boards_list is not None :
456461 for board in boards_list ["boards" ]:
457462 if arduino_platform in board ["FQBN" ]:
458463 fqbn_list_tmp .append (board ["FQBN" ])
459464 if not len (fqbn_list_tmp ):
460- raise subprocess .CalledProcessError (2 , "No fqbn" )
465+ print ("No boards found for " + arduino_platform )
466+ quit (1 )
461467 else :
462- raise subprocess .CalledProcessError (1 , "No fqbn" )
463- except subprocess .CalledProcessError :
464- print ("No fqbn found for " + arduino_platform + "!" )
465- quit (1 )
468+ print ("No boards found" + arduino_platform )
469+ quit (1 )
466470
467471 # For STM32 core, pnum is requested
468472 for fqbn in fqbn_list_tmp :
469473 try :
470474 output = subprocess .check_output (
471475 [arduino_cli , "board" , "details" , "--format" , "json" , fqbn ],
472- stderr = subprocess .DEVNULL ,
476+ stderr = subprocess .STDOUT ,
473477 ).decode ("utf-8" )
478+ except subprocess .CalledProcessError as e :
479+ print (
480+ '"' + " " .join (e .cmd ) + '" failed with code: {}!' .format (e .returncode )
481+ )
482+ print (e .stdout )
483+ quit (e .returncode )
484+ else :
474485 board_detail = json .loads (output )
475486 if board_detail is not None :
476487 if "config_options" not in board_detail :
477- raise subprocess .CalledProcessError (3 , "No config_options" )
488+ print ("No config_options found for " + fqbn )
489+ quit (1 )
478490 for option in board_detail ["config_options" ]:
479491 if option ["option" ] == "pnum" :
480492 for value in option ["values" ]:
@@ -486,9 +498,7 @@ def find_board():
486498 )
487499 break
488500 else :
489- raise subprocess .CalledProcessError (1 , "No fqbn" )
490- except subprocess .CalledProcessError as e :
491- print ('No fqbn detail found for:"' + " " .join (e .cmd ) + '"!' )
501+ print ('No detail found for:"' + fqbn + '"!' )
492502 if board_found :
493503 board_fqbn = collections .OrderedDict (sorted (board_found .items ()))
494504 else :
0 commit comments