Skip to content

Commit f0bba86

Browse files
committed
fix issues pointed by the ai reviewer
1 parent 6f43eda commit f0bba86

1 file changed

Lines changed: 11 additions & 4 deletions

File tree

src/makim/core.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -216,8 +216,8 @@ def _call_shell_app(
216216

217217
try:
218218
p.wait()
219+
return True
219220
except xh.ErrorReturnCode as e:
220-
os.close(fd)
221221
MakimLogs.raise_error(
222222
str(e.full_cmd),
223223
MakimError.SH_ERROR_RETURN_CODE,
@@ -226,15 +226,19 @@ def _call_shell_app(
226226
)
227227
return False
228228
except KeyboardInterrupt:
229-
os.close(fd)
230229
pid = p.pid
231230
p.kill_group()
232231
MakimLogs.raise_error(
233232
f'Process {pid} killed.',
234233
MakimError.SH_KEYBOARD_INTERRUPT,
234+
exit_on_error=exit_on_error,
235235
)
236-
os.close(fd)
237-
return True
236+
return False
237+
finally:
238+
try:
239+
os.close(fd)
240+
except OSError:
241+
pass # fd already closed
238242

239243
def _call_shell_remote(
240244
self, cmd: str, host_config: dict[str, Any], exit_on_error: bool = True
@@ -276,6 +280,7 @@ def _call_shell_remote(
276280
MakimLogs.raise_error(
277281
f'Authentication failed for host {host_config["host"]}',
278282
MakimError.SSH_AUTHENTICATION_FAILED,
283+
exit_on_error=exit_on_error,
279284
)
280285
return False
281286
except paramiko.SSHException as ssh_exception:
@@ -1015,7 +1020,9 @@ def process_matrix_combination(matrix_vars: dict[str, Any]) -> bool:
10151020
not found.
10161021
""",
10171022
MakimError.REMOTE_HOST_NOT_FOUND,
1023+
exit_on_error=exit_on_error,
10181024
)
1025+
return False
10191026
return self._call_shell_remote(
10201027
current_cmd,
10211028
cast(dict[str, Any], host_config),

0 commit comments

Comments
 (0)