fix code for finding existing processes

This commit is contained in:
Nathan Freitas 2014-02-22 19:16:47 -05:00
parent 16c5426ea0
commit 87411bea85
1 changed files with 3 additions and 1 deletions

View File

@ -91,6 +91,8 @@ public class TorServiceUtils implements TorServiceConstants {
Process procPs = null; Process procPs = null;
String baseName = new File(command).getName();
procPs = r.exec(SHELL_CMD_PS); procPs = r.exec(SHELL_CMD_PS);
BufferedReader reader = new BufferedReader(new InputStreamReader(procPs.getInputStream())); BufferedReader reader = new BufferedReader(new InputStreamReader(procPs.getInputStream()));
@ -98,7 +100,7 @@ public class TorServiceUtils implements TorServiceConstants {
while ((line = reader.readLine())!=null) while ((line = reader.readLine())!=null)
{ {
if (line.indexOf(' ' + command)!=-1) if (line.indexOf('/' + baseName)!=-1)
{ {
StringTokenizer st = new StringTokenizer(line," "); StringTokenizer st = new StringTokenizer(line," ");