Skip to content

Commit 882ebd4

Browse files
committed
fix issues pointed by the ai reviewer
1 parent ee29b1e commit 882ebd4

1 file changed

Lines changed: 8 additions & 3 deletions

File tree

src/makim/core.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,11 +218,12 @@ def _call_shell_app(
218218
p.wait()
219219
# Explicitly check exit code for defense in depth
220220
returncode = getattr(p, 'returncode', None)
221-
if returncode and returncode != 0:
221+
if returncode is None or returncode != 0:
222+
error_code = returncode if returncode is not None else 1
222223
MakimLogs.raise_error(
223-
f'Command exited with code {returncode}',
224+
f'Command exited with code {error_code}',
224225
MakimError.SH_ERROR_RETURN_CODE,
225-
returncode,
226+
error_code,
226227
exit_on_error=exit_on_error,
227228
)
228229
return False
@@ -249,6 +250,10 @@ def _call_shell_app(
249250
os.close(fd)
250251
except OSError:
251252
pass # fd already closed
253+
try:
254+
os.unlink(filepath)
255+
except OSError:
256+
pass # file already removed or inaccessible
252257

253258
def _call_shell_remote(
254259
self, cmd: str, host_config: dict[str, Any], exit_on_error: bool = True

0 commit comments

Comments
 (0)