Skip to content

Truncating logfile is difficult #16

@niko

Description

@niko

I don't know if that's an issue but I noticed that truncating the logfile (the redirected STDOUT) doesn't work, at least the way expected. When doing

echo '' > out.log
ls -l out.log

ls still shows the old filesize. df shows the diskspace being freed. The logfile contains somehow invisible characters. It seems the open file should be rewinded or seek the beginning again. I work around this with this code at the moment:

Signal.trap('USR2'){ STDOUT.truncate 0 ; STDOUT.rewind }

To reproduce see https://gist.github.com/1564418

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions