Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
Galanwe
8 months ago
|
parent
|
context
|
favorite
| on:
Self-contained Python scripts with uv
FYI, have a look at "trap .. EXIT" to defer cleanups like your unlink. It's neat cause it will run even if the script is interrupted / fails before the unlink.
lioeters
8 months ago
[–]
Useful tip, I suppose it will look like:
temp=$(mktemp) trap 'unlink $temp' EXIT # Do things
Galanwe
8 months ago
|
parent
[–]
Exactly. And if your cleanup is more involved you can call a cleanup function.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: