mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-07-27 18:12:29 +08:00
chore(nx/forge): print signing logs on error
This commit is contained in:
parent
6aaacd6ca1
commit
546bb52abe
@ -3,6 +3,8 @@ const { default: e } = require("express");
|
||||
const fs = require("fs");
|
||||
const path = require("path");
|
||||
|
||||
const LOG_LOCATION = "c:\\ev_signer_trilium\\ev_signer_trilium.err.log";
|
||||
|
||||
module.exports = function (sourcePath) {
|
||||
const { WINDOWS_SIGN_EXECUTABLE } = process.env;
|
||||
if (!WINDOWS_SIGN_EXECUTABLE) {
|
||||
@ -10,11 +12,6 @@ module.exports = function (sourcePath) {
|
||||
return;
|
||||
}
|
||||
|
||||
const buffer = fs.readFileSync(sourcePath);
|
||||
console.log("Platform: ", process.platform);
|
||||
console.log("CPU archi:", process.arch);
|
||||
console.log("DLL archi: ", getDllArchitectureFromBuffer(buffer));
|
||||
|
||||
try {
|
||||
const command = `${WINDOWS_SIGN_EXECUTABLE} --executable "${sourcePath}"`;
|
||||
console.log(`[Sign] ${command}`);
|
||||
@ -22,10 +19,26 @@ module.exports = function (sourcePath) {
|
||||
child_process.execSync(command);
|
||||
} catch (e) {
|
||||
console.error("[Sign] Got error while signing " + e.output.toString("utf-8"));
|
||||
printSigningErrorLogs(sourcePath);
|
||||
process.exit(2);
|
||||
}
|
||||
}
|
||||
|
||||
function printSigningErrorLogs(sourcePath) {
|
||||
const buffer = fs.readFileSync(sourcePath);
|
||||
console.log("Platform: ", process.platform);
|
||||
console.log("CPU archi:", process.arch);
|
||||
console.log("DLL archi: ", getDllArchitectureFromBuffer(buffer));
|
||||
|
||||
if (!fs.existsSync(LOG_LOCATION)) {
|
||||
console.warn("[Sign] No debug log file found.");
|
||||
return;
|
||||
}
|
||||
|
||||
const logContent = fs.readFileSync(LOG_LOCATION, "utf-8");
|
||||
console.error("[Sign] Debug log content:\n" + logContent);
|
||||
}
|
||||
|
||||
function getDllArchitectureFromBuffer(buffer) {
|
||||
// Check for MZ header
|
||||
if (buffer[0] !== 0x4D || buffer[1] !== 0x5A) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user