@@ -115,32 +115,27 @@ def run_command(self, *args, env_vars={}, user=None, group=None):
115
115
else :
116
116
process = subprocess .Popen (command , env = env , stdout = subprocess .PIPE , stderr = subprocess .PIPE , text = True , cwd = self .build_dir )
117
117
118
+ # Initialize logs
118
119
stdout_log = ""
119
120
stderr_log = ""
120
121
# Stream stdout in real-time
121
122
while True :
122
123
output = process .stdout .readline ()
123
- if output == b "" and process .poll () is not None :
124
+ if output == "" and process .poll () is not None :
124
125
break
125
126
if output :
126
- stdout_log += output . decode ()
127
- self .cprint (output . decode () , "light_grey" ) # Print stdout in real-time
128
-
127
+ stdout_log += output # No need to decode
128
+ self .cprint (output , "light_grey" ) # Print stdout in real-time
129
+ # Stream stderr in real-time
129
130
while True :
130
131
error = process .stderr .readline ()
131
- if error == b "" and process .poll () is not None :
132
+ if error == "" and process .poll () is not None :
132
133
break
133
134
if error :
134
- stderr_log += error .decode ()
135
- self .cprint (error .decode (), "red" ) # Print stderr in real-time
136
-
135
+ stderr_log += error # No need to decode
136
+ self .cprint (error , "red" ) # Print stderr in real-time
137
137
process .wait ()
138
-
139
- if process .returncode != 0 :
140
- raise subprocess .CalledProcessError (process .returncode , command , output = stdout_log , stderr = stderr_log )
141
-
142
- self .cprint (f"🐞 Command output: { stdout_log } " , "light_grey" )
143
- return stdout_log
138
+ return stdout_log , stderr_log # Return both logs
144
139
145
140
except subprocess .CalledProcessError as e :
146
141
print (f"Error running command: { e } " )
0 commit comments