Skip to content

Commit 4776637

Browse files
committed
The cleanup in the finally block does not fail silently anymore
1 parent b0f08c4 commit 4776637

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/build/src/extensions/python.ts

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,13 @@ export const runInline = async (scriptContent: string, options: Partial<XOptions
165165
try {
166166
return await runScript(tmpFile, [], options);
167167
} finally {
168-
await fs.promises.unlink(tmpFile);
168+
try {
169+
await fs.promises.unlink(tmpFile);
170+
} catch (error) {
171+
logger.warn(`Failed to clean up temporary file ${tmpFile}:`, {
172+
error: (error as Error).stack || (error as Error).message,
173+
});
174+
}
169175
}
170176
};
171177

0 commit comments

Comments
 (0)