-
-
Notifications
You must be signed in to change notification settings - Fork 221
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
Add .node()
method
#200
Add .node()
method
#200
Conversation
This is a working draft to check if I'm going the right way. As per #65 (comment), the fork method is just doing a spawn of a |
Thanks this new PR @GMartigny! This is going the right direction except:
|
Ok thanks @ehmicky for the help.
Is that a problem if that forth channel is only ever set to
Should we redirect all node arguments to this option ? |
Unless I am mistaken, this seems like at the moment, This could be solved by doing the
Yes
We need to pass |
From what I read on the node's source code, you can call Also, there are (IMO) arbitrary choices over options hierarchy. For example, an Here's what make sens to me, but I need confirmation:
Lines 3, 4, 4b and 9 don't follow what I read from Node's doc or code. |
All that logic is already handled by both
This is in essence what the Node.js code for The lines you describe do seem to follow Node.js core behavior for |
We don't have to restrict the If I push Unit Tests for that new function, could you review them ? I feel it would be better going TDD style. |
Sure any process works better for you will work for me :) Yes you're right about |
The tests look good 👍 |
Hi, tests are failing on Windows because: // This will be run on a fork of Node, which can't work
execa.fork("fixtures/hello.cmd"); // => node fixtures/hello.cmd
// Will spawn a new cmd that don't exit itself
execa.fork("fixtures\\hello.cmd", [], {execPath: "cmd.exe"}); // => cmd.exe fixtures\hello.cmd
// Same as
execa("cmd.exe", ["fixtures\\hello.cmd"]); I saw that Should we add the options ourselves or am I missing something ? |
I don't think the I.e. the two first commands above should throw an exception. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for going through this other round of reviews @GMartigny!
This looks good (except for small things).
However personally I think moving the tests and fixtures should have been done in a separate PR. But now that it's done, I guess we'll keep like that :)
readme.md
Outdated
@@ -180,6 +180,15 @@ Same as [`execa.command()`](#execacommand-command-options) but synchronous. | |||
|
|||
Returns or throws a [`childProcessResult`](#childProcessResult). | |||
|
|||
### execa.node(file, [arguments], [options]) | |||
|
|||
Run a file through a forked process. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not correct. It's not just a file, it's a script, and it's not a forked process, it's "spawning Node.js". Forking a process is a completely different thing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Related to #200 (comment)
Only a few minor tweaks and this looks good to me :) You also need to fix the merge conflict. |
Yay! Thanks for working on this :) |
Fix #65