When using the --follow option of tail a process is attached to the file being watched. This process prevents the user from renaming or deleting the file.
Steps to reproduce:
Setup:
Create a log file in the root drive c:\<log file>
Execute the tail command:
tail -f c:\<log file>
Conditions to test:
Test: Rename - attempt to rename the <log file>
Result: Windows reports that it cannot rename <log file>, it is being used by another person or process.
Expected: <log file> would be renamed and tail would continue to follow file after rename.
Test: Delete - attempt to delete the <log file>
Result: Windows reports that it cannot delete <log file>, it is being used by another person or process.
Expected: <log file> would be deleted and tail would report that the file had been truncated.
I'm guessing this is due to the default open in Win32: open (f->name, O_RDONLY); will still lock files and stop writes. To get the desired behaviour on Win32 the _sopen call can be used with _SH_DENYNO: _sopen( f->name, _O_RDONLY, _SH_DENYNO);
http://msdn.microsoft.com/en-us/library/w7sa2b22%28v=vs.71%29.aspx