diff --git a/apps/desktop/electron-forge/sign-windows.cjs b/apps/desktop/electron-forge/sign-windows.cjs index 68b1c354e..83a783e7e 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); + 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); + } - console.log(fs.readFileSync(filePath).subarray(0, 100)); - - 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