mirror of
https://github.com/processing/processing4.git
synced 2026-06-16 04:26:26 +02:00
Try to address Mac problem with emulator launch
This commit is contained in:
@@ -1,22 +1,9 @@
|
||||
package processing.app.tools.android;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import processing.app.Preferences;
|
||||
|
||||
public class EmulatorController {
|
||||
private static final ExecutorService threads = Executors
|
||||
.newSingleThreadExecutor(new ThreadFactory() {
|
||||
public Thread newThread(final Runnable r) {
|
||||
final Thread t = new Thread(r);
|
||||
t.setDaemon(true);
|
||||
t.setName("EmulatorController " + t.getId());
|
||||
return t;
|
||||
}
|
||||
});
|
||||
|
||||
class EmulatorController {
|
||||
static void launch() throws IOException {
|
||||
String portString = Preferences.get("android.emulator.port");
|
||||
if (portString == null) {
|
||||
@@ -39,21 +26,11 @@ public class EmulatorController {
|
||||
final String[] cmd = new String[] {
|
||||
"emulator", "-avd", AVD.ECLAIR.name, "-port", portString, "-netfast",
|
||||
"-no-boot-anim" };
|
||||
threads.execute(new Runnable() {
|
||||
public void run() {
|
||||
try {
|
||||
System.err.println("Launching emulator");
|
||||
final Process p = Runtime.getRuntime().exec(cmd);
|
||||
// "emulator: ERROR: the user data image is used by another emulator. aborting"
|
||||
// make sure that the streams are drained properly
|
||||
p.getInputStream().close();
|
||||
p.getErrorStream().close();
|
||||
// new StreamPump(p.getInputStream()).addTarget(System.out).start();
|
||||
// new StreamPump(p.getErrorStream()).addTarget(System.err).start();
|
||||
} catch (final IOException e) {
|
||||
e.printStackTrace(System.err);
|
||||
}
|
||||
}
|
||||
});
|
||||
System.err.println("Launching emulator");
|
||||
final Process p = Runtime.getRuntime().exec(cmd);
|
||||
// "emulator: ERROR: the user data image is used by another emulator. aborting"
|
||||
// make sure that the streams are drained properly
|
||||
new StreamPump(p.getInputStream()).addTarget(System.out).start();
|
||||
new StreamPump(p.getErrorStream()).addTarget(System.err).start();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user