Skip to content
This repository was archived by the owner on Nov 13, 2024. It is now read-only.

Commit ce254b2

Browse files
committed
新增 工作路径替换
1 parent b5792b5 commit ce254b2

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/entity/commands/general/general_update.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,8 @@ export default class GeneralUpdateCommand extends InstanceCommand {
4444
if (instance.asynchronousTask !== null) return instance.failure(new Error("实例状态不正确,有其他任务正在运行中"));
4545
try {
4646
instance.setLock(true);
47-
const updateCommand = instance.config.updateCommand;
47+
let updateCommand = instance.config.updateCommand;
48+
updateCommand = updateCommand.replace(/\$\{mcsm_workspace\}/gm, instance.config.cwd);
4849
logger.info(`实例 ${instance.instanceUuid} 正在准备进行更新操作...`);
4950
logger.info(`实例 ${instance.instanceUuid} 执行更新命令如下:`);
5051
logger.info(updateCommand);
@@ -90,8 +91,9 @@ export default class GeneralUpdateCommand extends InstanceCommand {
9091
instance.println("更新", "更新程序结束,但结果不正确,可能文件更新损坏或网络不畅通");
9192
}
9293
});
93-
} catch {
94+
} catch (err) {
9495
this.stoped(instance);
96+
instance.println("更新", `更新错误: ${err}`);
9597
}
9698
}
9799

0 commit comments

Comments
 (0)