@@ -145,19 +145,20 @@ export async function getCertificateFromStoreInfo(options: WindowsConfiguration,
145
145
export async function doSign ( configuration : CustomWindowsSignTaskConfiguration , packager : WinPackager ) {
146
146
// https://github.com/electron-userland/electron-builder/pull/1944
147
147
const timeout = parseInt ( process . env . SIGNTOOL_TIMEOUT as any , 10 ) || 10 * 60 * 1000
148
- // unify logic of signtool path location
149
- const toolInfo = await getToolPath ( )
150
- const tool = toolInfo . path
151
148
// decide runtime argument by cases
152
149
let args : Array < string >
153
150
let env = process . env
154
151
let vm : VmManager
155
- if ( configuration . path . endsWith ( ".appx" ) || ! ( "file" in configuration . cscInfo ! ) /* certificateSubjectName and other such options */ ) {
152
+ const vmRequired = configuration . path . endsWith ( ".appx" ) || ! ( "file" in configuration . cscInfo ! ) /* certificateSubjectName and other such options */
153
+ const isWin = process . platform === "win32" || vmRequired
154
+ const toolInfo = await getToolPath ( isWin )
155
+ const tool = toolInfo . path
156
+ if ( vmRequired ) {
156
157
vm = await packager . vm . value
157
- args = computeSignToolArgs ( configuration , true , vm )
158
+ args = computeSignToolArgs ( configuration , isWin , vm )
158
159
} else {
159
160
vm = new VmManager ( )
160
- args = configuration . computeSignToolArgs ( process . platform === "win32" )
161
+ args = configuration . computeSignToolArgs ( isWin )
161
162
if ( toolInfo . env != null ) {
162
163
env = toolInfo . env
163
164
}
@@ -292,7 +293,7 @@ function getWinSignTool(vendorPath: string): string {
292
293
}
293
294
}
294
295
295
- async function getToolPath ( ) : Promise < ToolInfo > {
296
+ async function getToolPath ( isWin = process . platform === "win32" ) : Promise < ToolInfo > {
296
297
if ( isUseSystemSigncode ( ) ) {
297
298
return { path : "osslsigncode" }
298
299
}
@@ -303,7 +304,7 @@ async function getToolPath(): Promise<ToolInfo> {
303
304
}
304
305
305
306
const vendorPath = await getSignVendorPath ( )
306
- if ( process . platform === "win32" ) {
307
+ if ( isWin ) {
307
308
// use modern signtool on Windows Server 2012 R2 to be able to sign AppX
308
309
return { path : getWinSignTool ( vendorPath ) }
309
310
} else if ( process . platform === "darwin" ) {
0 commit comments