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

consuming spawn UV_EACCES errors #1769

Closed
TrevTheDev opened this issue Feb 14, 2019 · 4 comments
Closed

consuming spawn UV_EACCES errors #1769

TrevTheDev opened this issue Feb 14, 2019 · 4 comments

Comments

@TrevTheDev
Copy link

  • Node.js Version: 11.9.0
  • OS: linux
  • Scope (install, code, runtime, meta, other?):
  • Module (and version) (if relevant):child_process.js

How should one consume UV_EACCES errors raised using spawn?

Assuming code like this:

const { spawn } = require('child_process');
const ls = spawn('ls', ['-lh', '/usr'],{cwd: '/dir/that/has/permissions/set/to666});

//next line throws an error because stdout does not exist due to UV_EACCES  error:
ls.stdout.on('data', (data) => {
  console.log(`stdout: ${data}`);
});

ls has an error event, but how should I access this before ls.stdout throws an error?

@gireeshpunathil
Copy link
Member

gireeshpunathil commented Apr 30, 2019

the way I understand spawn logic is: treat any errors that occur upto fork / clone system call within the parent, and synchronously, while anything after that, handle as an error event on the child process, asynchronously. When checked with strace, I see the UV_ACCESS is occurring once the child has started execution, so I would expect it to emit an error event, deeming it as a runtime error - I guess that is not happening here. Pinging @nodejs/child_process to see if there is an explanation to this behavior.

@cjihrig
Copy link

cjihrig commented May 14, 2019

I believe nodejs/node#26852 is tracking this same issue.

@gireeshpunathil
Copy link
Member

@TrevTheDev - nodejs/node#27696 is merged into node, does it solve your issue?

@gireeshpunathil
Copy link
Member

answered, closing

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