forked from mirror/MCSM-Daemon
Feat: 优化输出文字
This commit is contained in:
parent
9c791803dc
commit
86a5ff28ef
@ -78,7 +78,8 @@ export default class GeneralStartCommand extends InstanceCommand {
|
||||
}
|
||||
|
||||
async exec(instance: Instance, source = "Unknown") {
|
||||
if (!instance.config.startCommand || !instance.config.cwd || !instance.config.ie || !instance.config.oe) return instance.failure(new StartupError("启动命令,输入输出编码或工作目录为空值"));
|
||||
if (!instance.config.startCommand || !instance.config.cwd || !instance.config.ie || !instance.config.oe)
|
||||
return instance.failure(new StartupError("启动命令,输入输出编码或工作目录为空值"));
|
||||
if (!fs.existsSync(instance.absoluteCwdPath())) return instance.failure(new StartupError("工作目录并不存在"));
|
||||
|
||||
try {
|
||||
@ -138,6 +139,7 @@ ${instance.config.startCommand}
|
||||
// 产生开启事件
|
||||
instance.started(processAdapter);
|
||||
logger.info(`实例 ${instance.instanceUuid} 成功启动 PID: ${process.pid}.`);
|
||||
instance.println("INFO", "应用实例已运行,终端为普通终端模式,您可以在底部的命令输入框发送命令,不支持 Ctrl,Tab 等功能键");
|
||||
} catch (err) {
|
||||
instance.instanceStatus = Instance.STATUS_STOP;
|
||||
instance.releaseResources();
|
||||
|
@ -82,7 +82,8 @@ export default class PtyStartCommand extends InstanceCommand {
|
||||
}
|
||||
|
||||
async exec(instance: Instance, source = "Unknown") {
|
||||
if (!instance.config.startCommand || !instance.config.cwd || !instance.config.ie || !instance.config.oe) return instance.failure(new StartupError("启动命令,输入输出编码或工作目录为空值"));
|
||||
if (!instance.config.startCommand || !instance.config.cwd || !instance.config.ie || !instance.config.oe)
|
||||
return instance.failure(new StartupError("启动命令,输入输出编码或工作目录为空值"));
|
||||
if (!fs.existsSync(instance.absoluteCwdPath())) return instance.failure(new StartupError("工作目录并不存在"));
|
||||
|
||||
try {
|
||||
@ -93,7 +94,7 @@ export default class PtyStartCommand extends InstanceCommand {
|
||||
if (!fs.existsSync(ptyAppPath)) {
|
||||
logger.info(`会话 ${source}: 请求开启实例,模式为 PTY 终端`);
|
||||
logger.warn("PTY 终端转发程序不存在,自动降级到普通启动模式");
|
||||
instance.println("ERROR", "面板 PTY 终端依赖程序不存在,已自动降级到普通启动模式,您将无法使用 Ctrl,Tab 等快捷功能键。");
|
||||
instance.println("ERROR", "仿真终端模式失败,可能是依赖程序不存在,正在自动降级到普通终端模式...");
|
||||
// 关闭 PTY 类型,重新配置实例功能组,重新启动实例
|
||||
instance.config.terminalOption.pty = false;
|
||||
await instance.forceExec(new FunctionDispatcher());
|
||||
@ -109,7 +110,15 @@ export default class PtyStartCommand extends InstanceCommand {
|
||||
// 命令解析
|
||||
const commandList = commandStringToArray(instance.config.startCommand);
|
||||
if (commandList.length === 0) return instance.failure(new StartupError("无法启动实例,启动命令为空"));
|
||||
const ptyParameter = ["-dir", instance.config.cwd, "-cmd", JSON.stringify(commandList), "-size", `${instance.config.terminalOption.ptyWindowCol},${instance.config.terminalOption.ptyWindowRow}`, "-color"];
|
||||
const ptyParameter = [
|
||||
"-dir",
|
||||
instance.config.cwd,
|
||||
"-cmd",
|
||||
JSON.stringify(commandList),
|
||||
"-size",
|
||||
`${instance.config.terminalOption.ptyWindowCol},${instance.config.terminalOption.ptyWindowRow}`,
|
||||
"-color"
|
||||
];
|
||||
|
||||
logger.info("----------------");
|
||||
logger.info(`会话 ${source}: 请求开启实例.`);
|
||||
|
Loading…
Reference in New Issue
Block a user