mirror of
https://github.com/zadam/trilium.git
synced 2025-10-20 07:08:55 +02:00
24 lines
690 B
JavaScript
24 lines
690 B
JavaScript
const child_process = require("child_process");
|
|
const fs = require("fs");
|
|
|
|
module.exports = function (filePath) {
|
|
const { WINDOWS_SIGN_EXECUTABLE } = process.env;
|
|
|
|
const stats = fs.lstatSync(filePath);
|
|
console.log(filePath, stats);
|
|
|
|
if (!WINDOWS_SIGN_EXECUTABLE) {
|
|
console.warn("[Sign] Skip signing due to missing environment variable.");
|
|
return;
|
|
}
|
|
|
|
const command = `${WINDOWS_SIGN_EXECUTABLE} --executable "${filePath}"`;
|
|
console.log(`[Sign] ${command}`);
|
|
|
|
try {
|
|
child_process.execSync(command);
|
|
} catch (e) {
|
|
console.error("[Sign] Got error while signing " + e.output.toString("utf-8"));
|
|
process.exit(1);
|
|
}
|
|
} |