3 ms·
PrivateTmp in systemd does this.
by pram 2y ago
PrivateTmp in systemd does this.
- skissane 2y agoUnfortunately it only works for systemd units, as far as I am aware. Consider this use case: I have a test program which executes some unit tests, it creates some temporary files. I want the temporary files it creates to all be removed when it exits, even if it core dumps. But while it runs, I want those files to easily be accessible to subprocesses it spawns. I don't think systemd addresses this, because my unit test runner isn't going to be a systemd unit. So really I was talking about a generic facility an arbitrary program could use, not just something limited to systemd units only.
- Wowfunhappy 2y ago> Consider this use case: I have a test program which executes some unit tests, it creates some temporary files. I want the temporary files it creates to all be removed when it exits, even if it core dumps. But while it runs, I want those files to easily be accessible to subprocesses it spawns. For this precise use case, what if you deleted the last run's temporary files at the start of the test program?