File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1212from zap_common import DEFAULT_MATTER_PATH , DEFAULT_MATTER_TYPES_RELATIVE_PATH , DEFAULT_ZCL_JSON_RELATIVE_PATH
1313
1414
15- def get_attribute_name (attribute : ET .Element ) -> str | None :
15+ def get_attribute_name (attribute : ET .Element ) -> str :
1616 """If attribute has a name, return it, otherwise fallback to the text of the attribute entry."""
1717 from_attr = attribute .get ('name' )
1818 if from_attr :
Original file line number Diff line number Diff line change @@ -301,7 +301,12 @@ def display_zap_message(output: subprocess.CompletedProcess[str]) -> None:
301301 """
302302 If the output contains the error from napi_throw, suggest user to use zap-sync to sync the ZAP file and make sure that all attributes are provided.
303303 """
304- print (f"output: { output .stdout } " )
304+ if output .stdout :
305+ log .dbg (f"output: { output .stdout } " )
306+
307+ if output .stderr :
308+ log .wrn (f"stderr: { output .stderr } " )
309+
305310 if 'Unknown attribute' in output .stdout :
306311 log .err ("Your zcl.json file seems to be outdated or is missing some attributes. "
307312 "Please use 'west zap-sync' command to synchronize it with the newest Matter Data Model "
Original file line number Diff line number Diff line change @@ -104,7 +104,7 @@ def run_zap():
104104 output = subprocess .run ([str (x ) for x in cmd ], capture_output = True , text = True )
105105 # Chromium often prints nothing to stdout when the sandbox aborts early.
106106 # returncode -5 is a sentinel consumed by fix_sandbox_permissions().
107- if not output .stdout :
107+ if output . returncode != 0 and not output .stdout and not output . stderr :
108108 raise subprocess .CalledProcessError (- 5 , cmd )
109109 display_zap_message (output )
110110 return output
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ def run_zap():
9797 output = subprocess .run ([str (x ) for x in cmd ], capture_output = True , text = True )
9898 # Chromium often prints nothing to stdout when the sandbox aborts early.
9999 # returncode -5 is a sentinel consumed by fix_sandbox_permissions().
100- if not output .stdout :
100+ if output . returncode != 0 and not output .stdout and not output . stderr :
101101 raise subprocess .CalledProcessError (- 5 , cmd )
102102 display_zap_message (output )
103103 return output
You can’t perform that action at this time.
0 commit comments