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

Commit aa83b06

Browse files
committed
新增 识别异常捕捉
1 parent 16aee37 commit aa83b06

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

src/common/compress.ts

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -95,13 +95,21 @@ async function _7zipDecompress(sourceZip: string, destDir: string) {
9595
}
9696

9797
function haveLinuxUnzip() {
98-
const result = child_process.execSync("unzip -hh");
99-
return result?.toString("utf-8").toLowerCase().includes("extended help for unzip");
98+
try {
99+
const result = child_process.execSync("unzip -hh");
100+
return result?.toString("utf-8").toLowerCase().includes("extended help for unzip");
101+
} catch (error) {
102+
return false;
103+
}
100104
}
101105

102106
function haveLinuxZip() {
103-
const result = child_process.execSync("zip -h2");
104-
return result?.toString("utf-8").toLowerCase().includes("extended help for zip");
107+
try {
108+
const result = child_process.execSync("zip -h2");
109+
return result?.toString("utf-8").toLowerCase().includes("extended help for zip");
110+
} catch (error) {
111+
return false;
112+
}
105113
}
106114

107115
async function linuxUnzip(sourceZip: string, destDir: string) {

0 commit comments

Comments
 (0)