Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions src/main/java/com/thoughtworks/android/AndroidManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -119,14 +119,17 @@ public String startADBLogWithPackage(String udid, String packageName, String fil
process = cmd.execForProcessToExecute("adb -s " + udid
+ " logcat | grep -F \"`adb shell ps | grep " + packageName + " | cut -c10-15`\"" + " > " + filePath);
processUDIDs.put(udid, process);
return "Collecting ADB logs for device " + udid + " for package "+packageName+" in file " + filePath;
return "Collecting ADB logs for device " + udid + " for package " + packageName + " in file " + filePath;
}

public String stopADBLog(String udid) throws Exception {
Process p = processUDIDs.get(udid);
int id = (getPid(p) > 0) ? getPid(p) : 0;
cmd.runCommandThruProcess("kill -9 " + id);
return "Stopped collecting ADB logs " + udid;
if (getPid(p) > 0) {
cmd.runCommandThruProcess("kill -9 " + getPid(p));
return "Stopped collecting ADB logs " + udid;
} else
return "No process found to kill";

}

public int getPid(Process process) {
Expand Down