Repository: electron-userland/electron-builder
File: packages/app-builder-lib/src/winPackager.ts (TypeScript)

Code before:
      ...signOptions,
      cscInfo,
      options: {
        ...this.platformSpecificBuildOptions,
      },
    })
  }

  private async doSign(options: WindowsSignOptions) {
    let didSign = true
    for (let i = 0; i < 3; i++) {
      try {
        await sign(options, this)
        break
      } catch (e: any) {
        didSign = false
        // https://github.com/electron-userland/electron-builder/issues/1414
        const message = e.message
        if (message != null && message.includes("Couldn't resolve host name")) {
          log.warn({ error: message, attempt: i + 1 }, `cannot sign`)
          continue
        }
        throw e
      }
    }
    return didSign
  }

  async signAndEditResources(file: string, arch: Arch, outDir: string, internalName?: string | null, requestedExecutionLevel?: RequestedExecutionLevel | null) {
    const appInfo = this.appInfo

    const files: Array<string> = []

    const args = [
      file,
      "--set-version-string",
      "FileDescription",
      appInfo.productName,
      "--set-version-string",
      "ProductName",
      appInfo.productName,
      "--set-version-string",
      "LegalCopyright",
      appInfo.copyright,
      "--set-file-version",
      appInfo.shortVersion || appInfo.buildVersion,
      "--set-product-version",
      appInfo.shortVersionWindows || appInfo.getVersionInWeirdWindowsForm(),
    ]

    if (internalName != null) {

Review comment (suggestion):
This `didSign` flag logic needs to be flipped in order to handle the `continue` within the `catch`
```
let didSign = false
for (let i = 0; i < 3; i++) {
  try {
    await sign(options, this)
    didSign = true
    break
  } catch (e: any) {
    // https://github.com/electron-userland/electron-builder/issues/1414
    const message = e.message
    if (message != null && message.includes("Couldn't resolve host name")) {
      log.warn({ error: message, attempt: i + 1 }, `cannot sign`)
      continue
    }
    throw e
  }
}
return didSign
```

Code after:
      ...signOptions,
      cscInfo,
      options: {
        ...this.platformSpecificBuildOptions,
      },
    })
  }

  private async doSign(options: WindowsSignOptions) {
    for (let i = 0; i < 3; i++) {
      try {
        await sign(options, this)
        return true
      } catch (e: any) {
        // https://github.com/electron-userland/electron-builder/issues/1414
        const message = e.message
        if (message != null && message.includes("Couldn't resolve host name")) {
          log.warn({ error: message, attempt: i + 1 }, `cannot sign`)
          continue
        }
        throw e
      }
    }
    return false
  }

  async signAndEditResources(file: string, arch: Arch, outDir: string, internalName?: string | null, requestedExecutionLevel?: RequestedExecutionLevel | null) {
    const appInfo = this.appInfo

    const files: Array<string> = []

    const args = [
      file,
      "--set-version-string",
      "FileDescription",
      appInfo.productName,
      "--set-version-string",
      "ProductName",
      appInfo.productName,
      "--set-version-string",
      "LegalCopyright",
      appInfo.copyright,
      "--set-file-version",
      appInfo.shortVersion || appInfo.buildVersion,
      "--set-product-version",
      appInfo.shortVersionWindows || appInfo.getVersionInWeirdWindowsForm(),
    ]

    if (internalName != null) {
      args.push("--set-version-string", "InternalName", internalName, "--set-version-string", "OriginalFilename", "")
    }