@@ -139,21 +139,25 @@ def compile_libs(self) -> None:
139
139
print ("Error reading child process errors: " + str (e ))
140
140
label .update ("Compilation failed for " + target )
141
141
else :
142
- regex = r"^[1-9][0-9]*:[1-9][0-9]*$" # Regex to match the uid:gid format
143
- if self .app .setting_output_permissions and re .match (regex , self .app .setting_output_permissions ):
144
- print_info ("Changing permissions of generated files" )
145
- chown_process = None
146
- try :
147
- chown_process = subprocess .run (["chown" , "-R" , self .app .setting_output_permissions , self .app .setting_arduino_path ])
148
- chown_process .wait ()
149
- except Exception as e :
150
- print ("Error changing permissions: " + str (e ))
151
-
152
- if chown_process and chown_process .returncode != 0 :
153
- self .print_error ("Error changing permissions." )
154
- self .print_error ("Please change the ownership of generated files manually" )
142
+ if self .app .setting_output_permissions :
143
+ regex = r"^[1-9][0-9]*:[1-9][0-9]*$" # Regex to match the uid:gid format. Note that 0:0 (root) is not allowed
144
+ if re .match (regex , self .app .setting_output_permissions ):
145
+ print_info ("Setting permissions to: " + self .app .setting_output_permissions )
146
+ chown_process = None
147
+ try :
148
+ chown_process = subprocess .run (["chown" , "-R" , self .app .setting_output_permissions , self .app .setting_arduino_path ])
149
+ chown_process .wait ()
150
+ except Exception as e :
151
+ print ("Error changing permissions: " + str (e ))
152
+
153
+ if chown_process and chown_process .returncode != 0 :
154
+ self .print_error ("Error changing permissions" )
155
+ self .print_error ("Please change the ownership of generated files manually" )
156
+ else :
157
+ self .print_success ("Permissions changed successfully" )
155
158
else :
156
- self .print_success ("Permissions changed successfully" )
159
+ self .print_error ("Invalid permissions format: " + self .app .setting_output_permissions )
160
+ self .print_error ("Please change the ownership of generated files manually" )
157
161
158
162
self .print_success ("Compilation successful for " + target )
159
163
label .update ("Compilation successful for " + target )
0 commit comments