mirror of
https://github.com/processing/processing4.git
synced 2026-02-13 18:35:37 +01:00
Shut yourself down when your logcat is exhausted, please.
This commit is contained in:
@@ -176,17 +176,40 @@ class AndroidDevice implements AndroidDeviceProperties {
|
||||
new StreamPump(logcat.getInputStream()).addTarget(new LogLineProcessor())
|
||||
.start();
|
||||
new StreamPump(logcat.getErrorStream()).addTarget(System.err).start();
|
||||
System.err.println("Receiving log entries from " + id);
|
||||
new Thread(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
logcat.waitFor();
|
||||
// final int result = logcat.waitFor();
|
||||
// System.err.println("AndroidDevice: " + getId() + " logcat exited "
|
||||
// + (result == 0 ? "normally" : "with status " + result));
|
||||
} catch (final InterruptedException e) {
|
||||
System.err
|
||||
.println("AndroidDevice: logcat process monitor interrupted");
|
||||
} finally {
|
||||
shutdown();
|
||||
}
|
||||
}
|
||||
}, "AndroidDevice: logcat process monitor").start();
|
||||
// System.err.println("Receiving log entries from " + id);
|
||||
}
|
||||
|
||||
synchronized void shutdown() {
|
||||
System.err.println(id + " is shutting down.");
|
||||
if (!isAlive()) {
|
||||
return;
|
||||
}
|
||||
// System.err.println(id + " is shutting down.");
|
||||
if (logcat != null) {
|
||||
logcat.destroy();
|
||||
logcat = null;
|
||||
ProcessRegistry.unwatch(logcat);
|
||||
}
|
||||
env.deviceRemoved(this);
|
||||
if (activeProcesses.size() > 0) {
|
||||
for (final DeviceListener listener : listeners) {
|
||||
listener.sketchStopped();
|
||||
}
|
||||
}
|
||||
listeners.clear();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user