forked from mirror/MCSM-Daemon
Fix: 更改检查顺序
This commit is contained in:
parent
190f5217e1
commit
9f143f4981
@ -86,22 +86,10 @@ export default class PtyStartCommand extends InstanceCommand {
|
||||
if (!fs.existsSync(instance.absoluteCwdPath())) return instance.failure(new StartupError("工作目录并不存在"));
|
||||
|
||||
try {
|
||||
instance.setLock(true);
|
||||
// 设置启动状态
|
||||
instance.status(Instance.STATUS_STARTING);
|
||||
// 启动次数增加
|
||||
instance.startCount++;
|
||||
|
||||
// 命令解析
|
||||
const commandList = commandStringToArray(instance.config.startCommand);
|
||||
if (commandList.length === 0) {
|
||||
return instance.failure(new StartupError("无法启动实例,启动命令为空"));
|
||||
}
|
||||
// PTY 模式正确性检查
|
||||
let ptyAppName = "pty.exe";
|
||||
if (os.platform() !== "win32") ptyAppName = "pty";
|
||||
const ptyAppPath = path.normalize(path.join(process.cwd(), "lib", ptyAppName));
|
||||
const ptyParameter = ["-dir", instance.config.cwd, "-cmd", commandList.join(" "), "-size", `${instance.config.terminalOption.ptyWindowCol},${instance.config.terminalOption.ptyWindowRow}`];
|
||||
|
||||
if (!fs.existsSync(ptyAppPath)) {
|
||||
logger.info(`会话 ${source}: 请求开启实例,模式为 PTY 终端`);
|
||||
logger.warn("PTY 终端转发程序不存在,自动降级到普通启动模式");
|
||||
@ -113,6 +101,16 @@ export default class PtyStartCommand extends InstanceCommand {
|
||||
return;
|
||||
}
|
||||
|
||||
// 设置启动状态 & 启动次数增加
|
||||
instance.setLock(true);
|
||||
instance.status(Instance.STATUS_STARTING);
|
||||
instance.startCount++;
|
||||
|
||||
// 命令解析
|
||||
const commandList = commandStringToArray(instance.config.startCommand);
|
||||
if (commandList.length === 0) return instance.failure(new StartupError("无法启动实例,启动命令为空"));
|
||||
const ptyParameter = ["-dir", instance.config.cwd, "-cmd", commandList.join(" "), "-size", `${instance.config.terminalOption.ptyWindowCol},${instance.config.terminalOption.ptyWindowRow}`];
|
||||
|
||||
logger.info("----------------");
|
||||
logger.info(`会话 ${source}: 请求开启实例.`);
|
||||
logger.info(`实例标识符: [${instance.instanceUuid}]`);
|
||||
|
Loading…
Reference in New Issue
Block a user