node-rcedit icon indicating copy to clipboard operation
node-rcedit copied to clipboard

fix: Wrong executable path on WSL

Open Losses opened this issue 4 years ago • 6 comments

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 avatar Sep 27 '21 06:09 Losses

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

malept avatar Sep 27 '21 08:09 malept

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?

Losses avatar Sep 27 '21 09:09 Losses

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 avatar Sep 27 '21 14:09 malept

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

malept avatar Sep 27 '21 14:09 malept

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

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

Losses avatar Sep 28 '21 03:09 Losses

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.

malept avatar Sep 28 '21 03:09 malept

:tada: This PR is included in version 4.0.1 :tada:

The release is available on:

Your semantic-release bot :package::rocket:

continuous-auth[bot] avatar Nov 07 '23 22:11 continuous-auth[bot]