I need to be able to know all of the files a web browser has open (most specifically Google Chrome).
Right now I've only been able to find the results I need with lsof
since this is a fairly low-level operating system request. Basically I use lsof
and then look through the list it returns and determine whether any files are downloading and then take some actions based on this result.
The problem I'm having is that lsof
is a CPU pig even on a good day. Sometimes I'm hitting a wall where lsof
just goes nuts and lsof
has to be killed manually. I have to believe that Chrome does something funny as it seems as though it's the only misbehaved app that causing this trouble for lsof
.
I'd love to have a better way of detecting download activity, but haven't been able to come up with anything that's reliable.
It seems as though Chrome has some sort of file handle open that lsof
can't deal with or that causes it to suck down a serious amount of cpu time. (I'm wondering if the problem could be a giant memory-mapped file that Chrome uses as its own private virtual memory system or something?) Since this problem doesn't happen consistently I'm trying to hunt for lsof
options for macOS that might behave a little better...