Improve instance detection

Fix -i option
This commit is contained in:
2020-06-15 16:36:24 +02:00
parent 27404a4aa7
commit c72f90e5eb
4 changed files with 33 additions and 9 deletions

View File

@ -127,6 +127,18 @@ std::string Process::getName()
return name_;
}
std::vector<Process> Process::byName(const std::string& name)
{
std::vector<pid_t> procs = getAllProcessPids();
std::vector<Process> retProcs;
for(const auto & pid : procs )
{
Process proc(pid);
if(name == proc.getName()) retProcs.push_back(proc);
}
return retProcs;
}
pid_t Process::convertPid(const std::string& pid)
{
pid_t ret;