Android tests: do not call adb emu kill (throws exception if there are more than 1 emulator)

This commit is contained in:
Natalia.Ukhorskaya
2013-02-26 19:46:11 +04:00
parent 4ba4ac7e4e
commit ab792a587c
@@ -19,6 +19,7 @@ package org.jetbrains.jet.compiler.emulator;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.openapi.util.SystemInfo;
import com.intellij.openapi.util.text.StringUtil;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jet.compiler.OutputUtils;
import org.jetbrains.jet.compiler.PathManager;
import org.jetbrains.jet.compiler.ThreadUtils;
@@ -83,20 +84,17 @@ public class Emulator {
return commandLine;
}
@Nullable
private GeneralCommandLine getStopCommand() {
GeneralCommandLine commandLine = new GeneralCommandLine();
if (SystemInfo.isWindows) {
GeneralCommandLine commandLine = new GeneralCommandLine();
commandLine.setExePath("taskkill");
commandLine.addParameter("/F");
commandLine.addParameter("/IM");
commandLine.addParameter("emulator-arm.exe");
return commandLine;
}
else {
commandLine.setExePath(pathManager.getPlatformToolsFolderInAndroidSdk() + "/adb");
commandLine.addParameter("emu");
commandLine.addParameter("kill");
}
return commandLine;
return null;
}
public void createEmulator() {
@@ -118,7 +116,9 @@ public class Emulator {
public void stopEmulator() {
System.out.println("Stopping emulator...");
OutputUtils.checkResult(RunUtils.execute(getStopCommand()));
if (SystemInfo.isWindows) {
OutputUtils.checkResult(RunUtils.execute(getStopCommand()));
}
finishProcess("emulator-arm");
}