Skip to content

Commit

Permalink
Merge pull request #4 from oldelvet/110819-logcat-cleanup
Browse files Browse the repository at this point in the history
[FIXED JENKINS-10785] Ensure logcat process is properly terminated.
  • Loading branch information
orrc committed Sep 8, 2011
2 parents aaa15e3 + 7dd83c1 commit 0515f6c
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions src/main/java/hudson/plugins/android_emulator/AndroidEmulator.java
Expand Up @@ -531,11 +531,20 @@ private void cleanUp(PrintStream logger, Launcher launcher, AndroidSdk androidSd

// Clean up logging process
if (logcatProcess != null) {
logcatStream.close();
if (killed && logcatProcess.isAlive()) {
if (logcatProcess.isAlive()) {
// This should have stopped when the emulator was,
// but if not attempt to kill the process manually
logcatProcess.kill();
// Give the logcat process a final chance to finish
Thread.sleep(5 * 1000);
if (logcatProcess.isAlive()) {
// Still alive make sure process is killed
logcatProcess.kill();
}
}
try {
logcatStream.close();
} catch (Exception e) {
// Ignore
}

// Archive the logs
Expand Down

0 comments on commit 0515f6c

Please sign in to comment.