Skip to content
This repository has been archived by the owner on Apr 1, 2024. It is now read-only.

Commit

Permalink
Fix: 非Linux检查输出问题
Browse files Browse the repository at this point in the history
  • Loading branch information
YuMao233 committed Jul 18, 2022
1 parent 06cbf6a commit c04ad50
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/service/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,11 +29,10 @@ const PTY_DIR_PATH = path.join(process.cwd(), "lib");

function installPtyForLinux(url: string) {
return new Promise<number>((resolve, reject) => {
if (os.platform() !== "linux" || os.arch() !== "x64") {
if (os.arch() !== "x64") {
if (!fs.existsSync(PTY_PATH)) logger.info("仿真终端只能支持 Windows/Linux x86_64 架构,已自动降级为普通终端");
resolve(-1);
}

if (!fs.existsSync(PTY_DIR_PATH)) fs.mkdirsSync(PTY_DIR_PATH);
if (fs.existsSync(PTY_PATH) && fs.statSync(PTY_PATH)?.size > 1024) {
logger.info("识别到可选依赖库安装,仿真终端功能已可用");
Expand Down Expand Up @@ -65,6 +64,7 @@ function installPtyForLinux(url: string) {
// 仿真终端依赖程序,基于 Go/C++ 实现的 PTY 程序
// 参考:https://github.com/MCSManager/pty
export function initDependent() {
if (os.platform() !== "linux") return logger.info("检测到系统不是 Linux 系统,自动跳过依赖库安装");
const ptyUrls = ["https://mcsmanager.com/download/pty_linux", "https://mcsmanager.oss-cn-guangzhou.aliyuncs.com/pty_linux"];
function setup(index = 0) {
installPtyForLinux(ptyUrls[index])
Expand Down

0 comments on commit c04ad50

Please sign in to comment.