Reputation: 9265
I need a cross platform way to find a running process by name and get its process id. Then use boost's process library to terminate it.
Boost's process library requires process id to be known(http://www.highscore.de/boost/process/reference/classboost_1_1process_1_1process.html)
Upvotes: 3
Views: 4355
Reputation: 249394
I believe there is no such cross-platform facility. The closest I know of is pgrep
and that's a program, not a library, and it isn't part of Windows.
On Unix-like systems with procfs, you'll need to scan /proc
to match however you want to. I don't know how to do it on Windows, but I'm sure it's possible, and it can't be much worse than what you have to do on *nix.
Upvotes: 1