Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated from v1.0 to v2.0 and now detached: true always throws a TypeError #359

Closed
rynz opened this issue Aug 9, 2019 · 3 comments
Closed

Comments

@rynz
Copy link

rynz commented Aug 9, 2019

Node: v12.4.0 and Electron v6.0.1

const { spawn } = require('child_process')
spawn('C:\\Users\\ryanj\\AppData\\Local\\HideAway\\Update.exe', [ '--createShortcut', 'HideAway.exe' ], { detached: true })

Works no worries.

const execa = require('execa')

const run = async () => {
  const { stdout } = await execa('C:\\Users\\ryanj\\AppData\\Local\\HideAway\\Update.exe', [ '--createShortcut', 'HideAway.exe' ], { detached: true })
  return stdout
}

run().catch(err => {
  const stack = err.stack ? err.stack : String(err)
  const message = `Run exception:\n${stack}`
  console.error(message)
})

Always throw the following error:

Run exception:
TypeError: Cannot destructure property `error` of 'undefined' or 'null'.
    at handlePromise (D:\Work\Firetrust\Workspace\electron-hideaway\node_modules\execa\index.js:106:10)
    at processTicksAndRejections (internal/process/task_queues.js:89:5)

If I npm i execa@v1.0.0 it no longer throws the exception, when I npm i execa@latest the exception is back. It is also running the command successfully but throws none the less.

If I remove detached: true it no longer throws for v2.

@ehmicky
Copy link
Collaborator

ehmicky commented Aug 9, 2019

Hi @rynz, that's not good at all. I fixed it in #360. Thanks a lot for reporting this.

@rynz
Copy link
Author

rynz commented Aug 9, 2019

Thank you!

@sindresorhus
Copy link
Owner

Fixed by #360

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants