Co-authored-by: Yuhui Huang <jackhuang1998@gmail.com>
This commit is contained in:
@@ -24,13 +24,13 @@ import org.jackhuang.hmcl.event.ProcessStoppedEvent;
|
||||
import org.jackhuang.hmcl.util.Log4jLevel;
|
||||
import org.jackhuang.hmcl.util.StringUtils;
|
||||
import org.jackhuang.hmcl.util.platform.ManagedProcess;
|
||||
import org.jackhuang.hmcl.util.platform.OperatingSystem;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.function.BiConsumer;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author huangyuhui
|
||||
*/
|
||||
final class ExitWaiter implements Runnable {
|
||||
@@ -71,7 +71,12 @@ final class ExitWaiter implements Runnable {
|
||||
exitType = ProcessListener.ExitType.JVM_ERROR;
|
||||
} else if (exitCode != 0 || StringUtils.containsOne(errorLines, "Unable to launch")) {
|
||||
EventBus.EVENT_BUS.fireEvent(new ProcessExitedAbnormallyEvent(this, process));
|
||||
exitType = ProcessListener.ExitType.APPLICATION_ERROR;
|
||||
|
||||
if (exitCode == 137 && OperatingSystem.CURRENT_OS == OperatingSystem.LINUX) {
|
||||
exitType = ProcessListener.ExitType.SIGKILL;
|
||||
} else {
|
||||
exitType = ProcessListener.ExitType.APPLICATION_ERROR;
|
||||
}
|
||||
} else {
|
||||
exitType = ProcessListener.ExitType.NORMAL;
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ public interface ProcessListener {
|
||||
enum ExitType {
|
||||
JVM_ERROR,
|
||||
APPLICATION_ERROR,
|
||||
SIGKILL,
|
||||
NORMAL,
|
||||
INTERRUPTED
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user