-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathzsign-worker.js
More file actions
25 lines (19 loc) · 843 Bytes
/
zsign-worker.js
File metadata and controls
25 lines (19 loc) · 843 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
const { parentPort, workerData } = require('worker_threads');
const { exec } = require('child_process');
const util = require('util');
const path = require('path');
const execAsync = util.promisify(exec);
(async () => {
const { p12Path, p12Password, mpPath, ipaPath, signedIpaPath } = workerData;
try {
const isWindows = process.platform === 'win32';
const zsignExecutable = isWindows ? 'zsign.exe' : './zsign';
let zsignCmd = `${zsignExecutable} -z 5 -k "${p12Path}" `;
if (p12Password) zsignCmd += `-p "${p12Password}" `;
zsignCmd += `-m "${mpPath}" -o "${signedIpaPath}" "${ipaPath}"`;
const { stdout, stderr } = await execAsync(zsignCmd);
parentPort.postMessage({ status: 'ok', stdout, stderr });
} catch (error) {
parentPort.postMessage({ status: 'error', error: error.message });
}
})();