mirror of
https://github.com/TriliumNext/Notes.git
synced 2025-09-28 16:01:32 +08:00
chore(nx/forge): try to copy the file instead
This commit is contained in:
parent
9bf1e7b0b6
commit
ea4f5f157e
@ -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);
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user