I'm developing a text editor which opens files like this:
handle, errno := os.open(file_path, os.O_RDWR);
text, success := os.read_entire_file_from_handle(handle, context.temp_allocator);
But then something strange happens, if I run the odin check command in a separate Windows terminal, it fails to output errors in the file I opened using the above code in my text editor.
So the following happens
- Run odin check on a directory containing file A. It outputs errors for file A.
- Open file A using my text editor
- Run the same odin check command. This time, no errors are output for file A.
I'm thinking the problem is possibly related to the share mode when I open the file. Maybe my editor is holding the file hostage with exclusive access which is doing something funky to the odin check command. I checked the os.open() source and it does enable a share flag for reading and writing:
https://github.com/odin-lang/Odin/blob/fd582015fe2bbaabc42f78caefec1bd95f4d1465/core/os/file_windows.odin#L32
So I'm not sure why this would be happening, any ideas?