Skip to content

Commit

Permalink
[Electron Builder] Fix for Signing error on docker with WSL 2 engine … (
Browse files Browse the repository at this point in the history
#5722)

* [Electron Builder] Fix for Signing error on docker with WSL 2 engine #5185
The rcedit-x64.exe executable can't be called natively and this would be necessary for all uses of electron-builder from non-Windows (Linux & mac) environments.
  • Loading branch information
PRGWITHSTYLE authored Apr 8, 2021
1 parent 5d1afbb commit 0f3b46c
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions packages/app-builder-lib/src/winPackager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import isCI from "is-ci"
import { Lazy } from "lazy-val"
import * as path from "path"
import { downloadCertificate } from "./codeSign/codesign"
import { CertificateFromStoreInfo, CertificateInfo, FileCodeSigningInfo, getCertificateFromStoreInfo, getCertInfo, sign, WindowsSignOptions } from "./codeSign/windowsCodeSign"
import { CertificateFromStoreInfo, CertificateInfo, FileCodeSigningInfo, getCertificateFromStoreInfo, getCertInfo, getSignVendorPath, sign, WindowsSignOptions } from "./codeSign/windowsCodeSign"
import { AfterPackContext } from "./configuration"
import { DIR_TARGET, Platform, Target } from "./core"
import { RequestedExecutionLevel, WindowsConfiguration } from "./options/winOptions"
Expand All @@ -23,6 +23,7 @@ import { BuildCacheManager, digest } from "./util/cacheManager"
import { isBuildCacheEnabled } from "./util/flags"
import { time } from "./util/timer"
import { getWindowsVm, VmManager } from "./vm/vm"
import { execWine } from "./wine"

export class WinPackager extends PlatformPackager<WindowsConfiguration> {
readonly cscInfo = new Lazy<FileCodeSigningInfo | CertificateFromStoreInfo | null>(() => {
Expand Down Expand Up @@ -322,9 +323,13 @@ export class WinPackager extends PlatformPackager<WindowsConfiguration> {

const timer = time("wine&sign")
// rcedit crashed of executed using wine, resourcehacker works
if (process.platform === "win32" || this.info.framework.name === "electron") {
await executeAppBuilder(["rcedit", "--args", JSON.stringify(args)], undefined /* child-process */, {}, 3 /* retry five times */)
if (process.platform === "win32" || process.platform === "darwin") {
await executeAppBuilder(["rcedit", "--args", JSON.stringify(args)], undefined /* child-process */, {}, 3 /* retry three times */)
}
else if (this.info.framework.name === "electron") {
const vendorPath = await getSignVendorPath()
await execWine(path.join(vendorPath, "rcedit-ia32.exe"), path.join(vendorPath, "rcedit-x64.exe"), args)
}

await this.sign(file)
timer.end()
Expand Down

0 comments on commit 0f3b46c

Please sign in to comment.