Skip to content

Commit 2860d13

Browse files
authored
fix: incompatible Windows sign tool in end user environment. (#6817)
* 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
1 parent 8f57a90 commit 2860d13

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

.changeset/quiet-pandas-cover.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"app-builder-lib": patch
3+
---
4+
5+
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

packages/app-builder-lib/src/codeSign/windowsCodeSign.ts

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -145,19 +145,18 @@ export async function getCertificateFromStoreInfo(options: WindowsConfiguration,
145145
export async function doSign(configuration: CustomWindowsSignTaskConfiguration, packager: WinPackager) {
146146
// https://github.com/electron-userland/electron-builder/pull/1944
147147
const timeout = parseInt(process.env.SIGNTOOL_TIMEOUT as any, 10) || 10 * 60 * 1000
148-
149-
let tool: string
148+
// unify logic of signtool path location
149+
const toolInfo = await getToolPath()
150+
const tool = toolInfo.path
151+
// decide runtime argument by cases
150152
let args: Array<string>
151153
let env = process.env
152154
let vm: VmManager
153155
if (configuration.path.endsWith(".appx") || !("file" in configuration.cscInfo!) /* certificateSubjectName and other such options */) {
154156
vm = await packager.vm.value
155-
tool = getWinSignTool(await getSignVendorPath())
156157
args = computeSignToolArgs(configuration, true, vm)
157158
} else {
158159
vm = new VmManager()
159-
const toolInfo = await getToolPath()
160-
tool = toolInfo.path
161160
args = configuration.computeSignToolArgs(process.platform === "win32")
162161
if (toolInfo.env != null) {
163162
env = toolInfo.env

0 commit comments

Comments
 (0)