Fix: zip command params error

This commit is contained in:
unitwk 2022-11-13 15:07:47 +08:00
parent fbf88f0348
commit bf87a3910d
3 changed files with 247 additions and 4752 deletions

4987
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -5,7 +5,8 @@
"main": "src/app.js",
"scripts": {
"start": "ts-node ./src/app.ts",
"build": "tsc && webpack --config webpack.config.js"
"build": "tsc && webpack --config webpack.config.js",
"dev": "nodemon --watch ./src/**/*.ts --exec ts-node ./src/app.ts"
},
"homepage": "https://mcsmanager.com/",
"author": "https://github.com/unitwk",
@ -34,8 +35,8 @@
"yaml": "^1.10.2"
},
"devDependencies": {
"@types/axios": "^0.14.0",
"@types/archiver": "^5.3.1",
"@types/axios": "^0.14.0",
"@types/dockerode": "^3.2.7",
"@types/fs-extra": "^9.0.11",
"@types/iconv-lite": "0.0.1",
@ -49,6 +50,7 @@
"@types/pidusage": "^2.0.1",
"@types/uuid": "^8.3.0",
"eslint": "^7.13.0",
"nodemon": "^2.0.20",
"ts-node": "^9.1.1",
"typescript": "^4.2.4",
"webpack": "^5.73.0",

View File

@ -201,13 +201,15 @@ function hasGolangProcess() {
// ./pty_linux_arm64 -m unzip /Users/wangkun/Documents/OtherWork/MCSM-Daemon/data/InstanceData/3832159255b042da8cb3fd2012b0a996/tmp.zip /Users/wangkun/Documents/OtherWork/MCSM-Daemon/data/InstanceData/3832159255b042da8cb3fd2012b0a996
async function golangProcessUnzip(zipPath: string, destDir: string, fileCode: string = "utf-8") {
console.log("GO Zip Params", zipPath, destDir, fileCode);
return await new CommandProcess(PTY_PATH, ["-coder", fileCode, "-m", "unzip", zipPath, destDir], ".", 60 * 30, {}).start();
}
async function golangProcessZip(files: string[], destZip: string, fileCode: string = "utf-8") {
const p = ["-coder", fileCode, "-m", "zip"];
p.concat(files);
let p = ["-coder", fileCode, "-m", "zip"];
p = p.concat(files);
p.push(destZip);
console.log("GO Unzip Params", p);
return await new CommandProcess(PTY_PATH, p, ".", 60 * 30, {}).start();
}