Xenomortis wrote:I'm pretty sure the Win32 API has tools for pausing threads in another process, at least one that you spawned.
Even if I could do that, and I can't, I don't see how it would help.
I'm actually already using that for other purposes. (I use it to detect the creation of the file which I want to read in such a fashion.)
I thought about putting another watch on the file I'm interested in and doing stuff in the modification handler, but that seems too complex to be worth it (especially because I think watchdog starts up another thread to do the watching). Any opinion? It's not like my current solution is awful...
and I can probably turn down the polling interval a bit, say to 0.1.
phlip wrote:I know you say Program A can't be modified, but can you change what filename it's writing to? Can you get it to write to a named pipe?
This was an outstanding idea. Alas, I gave it a try and it didn't work.
TheChewanater wrote:EDIT: I don't know if this would work on Windows or not.
Windows doesn't have anything nearly as well-supported as LD_PRELOAD. The closest I know of is Detours
, and I'm not sure the non-professional edition would work for me. I have other reasons for not like the solution of injecting code into the target process too.
hotaru wrote:it sounds like you want to do something like what "tail -f -n +1" does...
Exactly, actually (except -c instead of -n because it's binary data). And while I of course recognized the correspondence, it didn't occur to me until you said that to check what tail does. I checked a couple different implementations, and it looks like tail at least sometimes
does somewhat what I do.
Now, it does
not check the file size, instead going off of what read() returns. I could probably improve mine by doing the same thing if I figure out what Python is doing to me.
(OTOH, it uses a much larger sleep than what I want; 0.25-1 sec.)