-
-
Notifications
You must be signed in to change notification settings - Fork 203
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
Re-using the features from execaNode()
#781
Comments
execaNode()
featuresexecaNode()
Why would you not want a |
The only reason I was thinking of was to avoid the cost of setting up the IPC channel. A named pipe is created (or is a TCP Unix socket used? I am not sure from looking at the libuv code). I am not sure whether this counts towards Performance-wise, the child process does some additional setup when it starts. I tried benchmarking it with the following code. import {spawn} from 'node:child_process'
import {once} from 'node:events'
console.time()
for (let i = 0; i < 1e3; i += 1) {
const childProcess = spawn('node', ['empty.js'], {stdio: ['pipe', 'pipe', 'pipe', 'ipc']})
await once(childProcess, 'exit')
}
console.timeEnd()
console.time()
for (let i = 0; i < 1e3; i += 1) {
const childProcess = spawn('node', ['empty.js'], {stdio: ['pipe', 'pipe', 'pipe']})
await once(childProcess, 'exit')
}
console.timeEnd() Which gives me (Node 21.1.0, Ubuntu):
I am not sure though whether the reasons above are enough to justify creating an |
People can just do |
Yes, that's a good point. Also, the benchmark is on an empty file. The time to actually load the file should be much higher, making the time spent setting up the So, what are you suggesting is the following, is this correct?
|
Yes And make sure there is a test for |
execaNode()
has some nice features:'node'
as the binary argument--inspect
shell: false
However, those features are not available for users who either:
$
orexecaCommand()
execaSync()
ipc
channelWe could fix this by adding a
{ node: true }
option (any other option name works too), which would do the same thing as whatexecaNode()
is doing, except for adding anipc
channel.What do you think?
The text was updated successfully, but these errors were encountered: