Skip to content

Commit

Permalink
fix: incompatible Windows sign tool in end user environment. (#6817)
Browse files Browse the repository at this point in the history
* unify locate logic of windows signtool path
side-effect: accept env variable SIGNTOOL_PATH for end-user customization.
E.g. electron-builder bundle signtool.exe failed to sign in Windows 11 environment
  • Loading branch information
rainbean committed May 1, 2022
1 parent 8f57a90 commit 2860d13
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
5 changes: 5 additions & 0 deletions .changeset/quiet-pandas-cover.md
@@ -0,0 +1,5 @@
---
"app-builder-lib": patch
---

fix: incompatible Windows sign tool in end user environment. Unify code logic to give end-user a chance to assign correct signtool.exe path with environment variable
9 changes: 4 additions & 5 deletions packages/app-builder-lib/src/codeSign/windowsCodeSign.ts
Expand Up @@ -145,19 +145,18 @@ export async function getCertificateFromStoreInfo(options: WindowsConfiguration,
export async function doSign(configuration: CustomWindowsSignTaskConfiguration, packager: WinPackager) {
// https://github.com/electron-userland/electron-builder/pull/1944
const timeout = parseInt(process.env.SIGNTOOL_TIMEOUT as any, 10) || 10 * 60 * 1000

let tool: string
// unify logic of signtool path location
const toolInfo = await getToolPath()
const tool = toolInfo.path
// decide runtime argument by cases
let args: Array<string>
let env = process.env
let vm: VmManager
if (configuration.path.endsWith(".appx") || !("file" in configuration.cscInfo!) /* certificateSubjectName and other such options */) {
vm = await packager.vm.value
tool = getWinSignTool(await getSignVendorPath())
args = computeSignToolArgs(configuration, true, vm)
} else {
vm = new VmManager()
const toolInfo = await getToolPath()
tool = toolInfo.path
args = configuration.computeSignToolArgs(process.platform === "win32")
if (toolInfo.env != null) {
env = toolInfo.env
Expand Down

0 comments on commit 2860d13

Please sign in to comment.