private void KillOldInstances(string gdbServerProcessName) { Debug.Assert(_shell != null, "KillOldInstances called before m_shell is set"); int sdkVersion = VerifySdkVersion(); if (sdkVersion >= 26) { ExecCommand("ps -A"); } else { ExecCommand("ps"); } var processList = new ProcessListParser(_shell.Out); if (!_launchOptions.IsAttach) { foreach (int pid in processList.FindProcesses(_launchOptions.Package)) { KillRemoteProcess(pid); } } foreach (int pid in processList.FindProcesses(gdbServerProcessName)) { KillRemoteProcess(pid); } }
/// <summary> /// Returns the process id's for any running instances of a process /// </summary> /// <param name="processName">the process name to look for pids</param> /// <returns>A list of process id's</returns> private List <int> GetProcessIds(string processName) { Debug.Assert(_shell != null, "GetProcessIds called before m_shell is set"); ExecCommandNoLog("ps"); var processList = new ProcessListParser(_shell.Out); return(processList.FindProcesses(processName)); }
/// <summary> /// Returns the process id's for any running instances of a process /// </summary> /// <param name="processName">the process name to look for pids</param> /// <returns>A list of process id's</returns> private List <int> GetProcessIds(string processName) { Debug.Assert(_shell != null, "GetProcessIds called before m_shell is set"); int sdkVersion = VerifySdkVersion(); if (sdkVersion >= 26) { ExecCommandNoLog("ps -A"); } else { ExecCommandNoLog("ps"); } var processList = new ProcessListParser(_shell.Out); return(processList.FindProcesses(processName)); }
public void TestProcessListParser2() { List<int> result; var processListParer = new ProcessListParser(GetFakeProcessListText2()); result = processListParer.FindProcesses("hellojni"); Assert.Equal(result.Count, 0); result = processListParer.FindProcesses("com.example.hellojni"); Assert.Equal(result.Count, 1); Assert.Equal(result[0], 7848); result = processListParer.FindProcesses("com.example.memory_hog"); Assert.Equal(result.Count, 1); Assert.Equal(result[0], 7915); }
public void TestProcessListParser1() { List<int> result; var processListParer = new ProcessListParser(GetFakeProcessListText1()); result = processListParer.FindProcesses("hellojni"); Assert.Equal(result.Count, 0); result = processListParer.FindProcesses("com.example.hellojni"); Assert.Equal(result.Count, 1); Assert.Equal(result[0], 1165); result = processListParer.FindProcesses("fake_name"); Assert.Equal(result.Count, 2); Assert.Equal(result[0], 2); Assert.Equal(result[1], 3); }
private void KillOldInstances(string gdbServerProcessName) { Debug.Assert(_shell != null, "KillOldInstances called before m_shell is set"); ExecCommand("ps"); var processList = new ProcessListParser(_shell.Out); if (!_launchOptions.IsAttach) { foreach (int pid in processList.FindProcesses(_launchOptions.Package)) { KillRemoteProcess(pid); } } foreach (int pid in processList.FindProcesses(gdbServerProcessName)) { KillRemoteProcess(pid); } }
/// <summary> /// Returns the process id's for any running instances of a process /// </summary> /// <param name="processName">the process name to look for pids</param> /// <returns>A list of process id's</returns> private List<int> GetProcessIds(string processName) { Debug.Assert(_shell != null, "GetProcessIds called before m_shell is set"); ExecCommandNoLog("ps"); var processList = new ProcessListParser(_shell.Out); return processList.FindProcesses(processName); }