MCPcopy Create free account
hub / github.com/MCSManager/MCSManager / check7zipStatus

Function check7zipStatus

daemon/src/service/seven_zip_service.ts:70–92  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

68 * Check if 7zip is working properly
69 */
70export async function check7zipStatus(): Promise<boolean> {
71 try {
72 if (isChecked7zip) return true;
73 if (!existsSync(SEVEN_ZIP_PATH)) return false;
74 try {
75 await fs.chmod(SEVEN_ZIP_PATH, 0o755);
76 } catch (chmodError: any) {
77 logger.warn($t("TXT_CODE_9ade0fb8", { message: chmodError.message }));
78 }
79 const { stdout } = await execPromise(`"${SEVEN_ZIP_PATH}" i`, {
80 timeout: 5 * 1000
81 });
82 if (stdout.includes("7-Zip") && stdout.includes("Copyright")) {
83 logger.info($t("TXT_CODE_a7c73a51", { info: stdout.split("\n")[1].trim() }));
84 isChecked7zip = true;
85 return true;
86 }
87 return false;
88 } catch (error: any) {
89 // ignore error
90 return false;
91 }
92}

Callers 1

decompressFunction · 0.90

Calls 3

$tFunction · 0.90
chmodMethod · 0.80
infoMethod · 0.80

Tested by

no test coverage detected