Skip to content

Build your personal knowledge base with Trilium Notes

chore(nx/forge): try to copy the file instead

Elian Doranea4f5f157eef
diff --git a/apps/desktop/electron-forge/sign-windows.cjs b/apps/desktop/electron-forge/sign-windows.cjs
index 68b1c354e4..83a783e7e0 100644
--- a/apps/desktop/electron-forge/sign-windows.cjs
+++ b/apps/desktop/electron-forge/sign-windows.cjs
@@ -1,8 +1,8 @@
const child_process = require("child_process");
const fs = require("fs");
-const { default: path } = require("path");
+const path = require("path");
-module.exports = function (filePath) {
+module.exports = function (sourcePath) {
const { WINDOWS_SIGN_EXECUTABLE } = process.env;
if (!WINDOWS_SIGN_EXECUTABLE) {
@@ -10,18 +10,23 @@ module.exports = function (filePath) {
return;
}
- console.log(filePath, fs.realpathSync(filePath));
- filePath = fs.realpathSync(filePath);
-
- console.log(fs.readFileSync(filePath).subarray(0, 100));
+ const destPath = path.resolve(path.basename(sourcePath));
+ try {
+ fs.copyFileSync(sourcePath, destPath);
+ } catch (e) {
+ console.error(`Unable to copy ${sourcePath} -> ${destPath}: ${e.message}`);
+ process.exit(1);
+ }
- const command = `${WINDOWS_SIGN_EXECUTABLE} --executable "${filePath}"`;
+ const command = `${WINDOWS_SIGN_EXECUTABLE} --executable "${destPath}"`;
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);
+ process.exit(2);
+ } finally {
+ fs.rmSync(destPath);
}
}
\ No newline at end of file