Skip to content
This repository was archived by the owner on Apr 6, 2026. It is now read-only.

fix: Wrong executable path on WSL - #89

Merged
erickzhao merged 1 commit into
electron:mainfrom
Losses:patch-1
Nov 7, 2023
Merged

fix: Wrong executable path on WSL#89
erickzhao merged 1 commit into
electron:mainfrom
Losses:patch-1

Conversation

@Losses

@Losses Losses commented Sep 27, 2021

Copy link
Copy Markdown
Contributor

The path of executable file to be modified is not parsed properly on WSL, without normalizePath, it will try to modify the path inside WSL, which is not recognized properly, this PR fixed the problem.

Unable to load file: "/tmp/electron-packager/win32-x64/zheng-desktop-template-win32-x64/zheng-desktop-template.exe"
    at ChildProcess.<anonymous> (/mnt/d/dev/zheng-desktop-template/node_modules/cross-spawn-windows-exe/node_modules/@malept/cross-spawn-promise/src/index.ts:172:16)
    at ChildProcess.emit (events.js:375:28)
    at ChildProcess.emit (domain.js:470:12)
    at maybeClose (internal/child_process.js:1055:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5) {
  cmd: '/mnt/d/dev/zheng-desktop-template/node_modules/rcedit/bin/rcedit-x64.exe',
  args: [
    '/tmp/electron-packager/win32-x64/zheng-desktop-template-win32-x64/zheng-desktop-template.exe',
    '--set-version-string',
    'FileDescription',
    'zheng-desktop-template',
    '--set-version-string',
    'InternalName',
    'zheng-desktop-template',
    '--set-version-string',
    'OriginalFilename',
    'zheng-desktop-template.exe',
    '--set-version-string',
    'ProductName',
    'zheng-desktop-template',
    '--set-version-string',
    'CompanyName',
    'Losses Don',
    '--set-file-version',
    '1.0.0',
    '--set-product-version',
    '1.0.0'
  ],
  stdout: '',
  stderr: 'Unable to load file: "/tmp/electron-packager/win32-x64/zheng-desktop-template-win32-x64/zheng-desktop-template.exe"\r\n',
  code: 1
}

Electron Forge was terminated. Location:
{}

Please notice the first argument:

    '/tmp/electron-packager/win32-x64/zheng-desktop-template-win32-x64/zheng-desktop-template.exe',

This is incorrect ;)

@Losses Losses mentioned this pull request Sep 27, 2021
@malept

malept commented Sep 27, 2021

Copy link
Copy Markdown
Member

Can you please add a test for this so we don't regress (again)?

@Losses

Losses commented Sep 27, 2021

Copy link
Copy Markdown
Contributor Author

Can you please add a test for this so we don't regress (again)?

@malept I'd like to, but it confused me a lot, that how to mock a WSL environment, and how to know wslpath is called in other operating system?

Is this acceptable if this test can only be run in WSL?

@malept

malept commented Sep 27, 2021

Copy link
Copy Markdown
Member

Seems like you'd have to mock out both the is-wsl module and the call to cross-spawn-windows-exe's spawn of wslpath. I don't think CircleCI supports testing in WSL.

@malept

malept commented Sep 27, 2021

Copy link
Copy Markdown
Member

Also it seems that there is no CI being run for this PR 😞

@Losses

Losses commented Sep 28, 2021

Copy link
Copy Markdown
Contributor Author

Also it seems that there is no CI being run for this PR 😞

Yeah... It seems that such case is not testable...

@malept

malept commented Sep 28, 2021

Copy link
Copy Markdown
Member

Also it seems that there is no CI being run for this PR disappointed

Yeah... It seems that such case is not testable...

I fixed CI if you push another commit with the mocks I suggested.

@dsanders11
dsanders11 self-requested a review November 7, 2023 22:46
@erickzhao
erickzhao merged commit 8370d62 into electron:main Nov 7, 2023
@continuous-auth

Copy link
Copy Markdown

🎉 This PR is included in version 4.0.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants