forked from mirror/MCSM-Daemon
Feat: 统一文案口径
This commit is contained in:
parent
6083435df2
commit
abaf6f7dc6
@ -153,7 +153,7 @@ ${instance.config.startCommand}
|
|||||||
参数:${JSON.stringify(ptyParameter)}
|
参数:${JSON.stringify(ptyParameter)}
|
||||||
|
|
||||||
请将此信息报告给管理员,技术人员或自行排查故障。
|
请将此信息报告给管理员,技术人员或自行排查故障。
|
||||||
如果您认为是面板伪终端导致的问题,请在左侧终端设置中关闭“伪终端”选项,我们将会采用原始输入输出流的方式监听程序。
|
如果您认为是面板仿真终端导致的问题,请在左侧终端设置中关闭“仿真终端”选项,我们将会采用原始输入输出流的方式监听程序。
|
||||||
`
|
`
|
||||||
);
|
);
|
||||||
throw new StartupError("实例启动失败,请检查启动命令,主机环境和配置文件等");
|
throw new StartupError("实例启动失败,请检查启动命令,主机环境和配置文件等");
|
||||||
|
@ -30,20 +30,28 @@ export default class PtyStopCommand extends InstanceCommand {
|
|||||||
|
|
||||||
async exec(instance: Instance) {
|
async exec(instance: Instance) {
|
||||||
const stopCommand = instance.config.stopCommand;
|
const stopCommand = instance.config.stopCommand;
|
||||||
if (stopCommand.toLocaleLowerCase() == "^c") return instance.failure(new Error("伪终端无法使用^C命令关闭进程,请重新设置关服命令"));
|
if (stopCommand.toLocaleLowerCase() == "^c")
|
||||||
|
return instance.failure(new Error("仿真终端无法使用Ctrl+C命令关闭进程,请重新设置关服命令"));
|
||||||
|
|
||||||
if (instance.status() === Instance.STATUS_STOP || !instance.process) return instance.failure(new Error("实例未处于运行中状态,无法进行停止"));
|
if (instance.status() === Instance.STATUS_STOP || !instance.process)
|
||||||
|
return instance.failure(new Error("实例未处于运行中状态,无法进行停止"));
|
||||||
instance.status(Instance.STATUS_STOPPING);
|
instance.status(Instance.STATUS_STOPPING);
|
||||||
|
|
||||||
await instance.exec(new SendCommand(stopCommand));
|
await instance.exec(new SendCommand(stopCommand));
|
||||||
|
|
||||||
instance.println("INFO", `已执行预设的关闭命令:${stopCommand}\n如果无法关闭实例请前往实例设置更改关闭实例的正确命令,比如 exit,stop,end 等`);
|
instance.println(
|
||||||
|
"INFO",
|
||||||
|
`已执行预设的关闭命令:${stopCommand}\n如果无法关闭实例请前往实例设置更改关闭实例的正确命令,比如 exit,stop,end 等`
|
||||||
|
);
|
||||||
|
|
||||||
// 若 10 分钟后实例还处于停止中状态,则恢复状态
|
// 若 10 分钟后实例还处于停止中状态,则恢复状态
|
||||||
const cacheStartCount = instance.startCount;
|
const cacheStartCount = instance.startCount;
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
if (instance.status() === Instance.STATUS_STOPPING && instance.startCount === cacheStartCount) {
|
if (instance.status() === Instance.STATUS_STOPPING && instance.startCount === cacheStartCount) {
|
||||||
instance.println("ERROR", "关闭命令已发出但长时间未能关闭实例,可能是实例关闭命令错误或实例进程假死导致,现在将恢复到运行中状态,可使用强制终止指令结束进程。");
|
instance.println(
|
||||||
|
"ERROR",
|
||||||
|
"关闭命令已发出但长时间未能关闭实例,可能是实例关闭命令错误或实例进程假死导致,现在将恢复到运行中状态,可使用强制终止指令结束进程。"
|
||||||
|
);
|
||||||
instance.status(Instance.STATUS_RUNNING);
|
instance.status(Instance.STATUS_RUNNING);
|
||||||
}
|
}
|
||||||
}, 1000 * 60 * 10);
|
}, 1000 * 60 * 10);
|
||||||
|
@ -51,7 +51,7 @@ export default class InstanceConfig {
|
|||||||
public terminalOption = {
|
public terminalOption = {
|
||||||
haveColor: false,
|
haveColor: false,
|
||||||
pty: true,
|
pty: true,
|
||||||
ptyWindowCol: 80,
|
ptyWindowCol: 140,
|
||||||
ptyWindowRow: 40
|
ptyWindowRow: 40
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -25,7 +25,7 @@ import RouterContext from "../entity/ctx";
|
|||||||
import * as protocol from "../service/protocol";
|
import * as protocol from "../service/protocol";
|
||||||
import InstanceSubsystem from "../service/system_instance";
|
import InstanceSubsystem from "../service/system_instance";
|
||||||
import fs from "fs-extra";
|
import fs from "fs-extra";
|
||||||
const MAX_LOG_SIZE = 1024;
|
const MAX_LOG_SIZE = 512;
|
||||||
|
|
||||||
// 缓存区
|
// 缓存区
|
||||||
const buffer = new Map<string, string>();
|
const buffer = new Map<string, string>();
|
||||||
|
@ -109,7 +109,7 @@ routerApp.on("stream/input", async (ctx, data) => {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// 处理终端输入,适用于伪终端的直连输入输出流。
|
// 处理终端输入,适用于仿真终端的直连输入输出流。
|
||||||
routerApp.on("stream/write", async (ctx, data) => {
|
routerApp.on("stream/write", async (ctx, data) => {
|
||||||
try {
|
try {
|
||||||
const buf = data.input;
|
const buf = data.input;
|
||||||
|
Loading…
Reference in New Issue
Block a user