Feat: Cross-platform pty

This commit is contained in:
unitwk 2022-08-20 15:04:39 +08:00
parent 24815444d0
commit 08acf31894
2 changed files with 3 additions and 6 deletions

View File

@ -3,7 +3,9 @@
import os from "os";
import path from "path";
const PTY_PATH = path.normalize(path.join(process.cwd(), "lib", os.platform() === "win32" ? "pty.exe" : "pty"));
const ptyName = `pty_${os.platform()}_${os.arch()}${os.platform() === "win32" ? ".exe" : ""}`;
const PTY_PATH = path.normalize(path.join(process.cwd(), "lib", ptyName));
const FILENAME_BLACKLIST = ["\\", "/", ".", "'", '"', "?", "*", "<", ">"];

View File

@ -104,11 +104,6 @@ export default class PtyStartCommand extends InstanceCommand {
checkPtyEnv = false;
}
if ((os.platform() !== "linux" && os.platform() !== "win32") || os.arch() !== "x64") {
instance.println("ERROR", $t("pty_start.notSupportPty"));
checkPtyEnv = false;
}
if (checkPtyEnv === false) {
// Close the PTY type, reconfigure the instance function group, and restart the instance
instance.config.terminalOption.pty = false;