Not sure how you are detecting that the append it not working - it usually does because a client can relink the inode to another file name using a syscall
I think what you want to do it either 1. Open the file exclusively so git cannot do this. 2. Check that the file create time is the same as when you first opened the file (you have to make the fstat() by name) > On Dec 10, 2023, at 10:59 AM, Jan Mercl <0xj...@gmail.com> wrote: > > On Sun, Dec 10, 2023 at 5:41 PM Jason E. Aten <j.e.a...@gmail.com> wrote: > >> My question is: is there a way to have the Go process detect if the file it >> is writing to has been deleted by another process (git in this case) so that >> attempting to append to the file is no longer effective? > > It is effective and [most] operations on the file continue to work as > usual. "Removing" a file, like in `os.Remove` is just removing one > reference to it. Only when the reference count drops to zero is the > file deleted. > > This is, AFAIK, how nixes work and it's IMO actually a neat feature. > It enables, for example, updating files without disrupting processes > that have those files opened. Less advanced operating systems, to > achieve the same effect, have to reboot etc. > > -- > You received this message because you are subscribed to the Google Groups > "golang-nuts" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to golang-nuts+unsubscr...@googlegroups.com. > To view this discussion on the web visit > https://groups.google.com/d/msgid/golang-nuts/CAA40n-VZDOdwMOqqmAc-RgpGyNkOi0LvyFR%2BKbzem4PqNNwrYQ%40mail.gmail.com. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/2B61F3AA-7C01-4172-A7B2-684CDFADC5A9%40ix.netcom.com.