dagolden / Capture-Tiny

(Perl) Capture STDOUT and STDERR from Perl, XS or external programs
http://search.cpan.org/dist/Capture-Tiny/
39 stars 19 forks source link

tee_merged leaves cruft in /tmp #45

Closed tomwitt2 closed 8 years ago

tomwitt2 commented 8 years ago

Using tee_merged leaves temporary files behind in /tmp on completion.

xdg commented 8 years ago

I've tried to replicate this and haven't been able to. I've set TMPDIR to an empty directory and run a script that does tee_merged. I see files in the local tmpdir during the run, but they are cleaned up at the end.

Can you elaborate more on what happened for you? Or could you please try to provide a reproduction?

Thanks.

ggl commented 8 years ago

It's a daemon that's executed by root, double forks in the background, and runs other scripts under lower privileges. Basically it does something in the lines of this.

xdg commented 8 years ago

Can you try it dropping privileges before you run capture_merged? Otherwise, I can easily imagine that the new UID doesn't have rights to clean up the old tempfiles.

If that's the case, I'll add that as a caveat to the documentation.

ggl commented 8 years ago

Hmm yup I should probably do that in the eval. All the temp file as created with root privileges, so that must be the obvious cause for leaving cruft behind.