You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This function is used by spawn-wrap to patch spawnSync.
It is possible to avoid patching the internals at the top level by creating a wrapped spawn function. The main issue is caused by processes deep in the process tree: spawn-wrap tries to hook into user-code spawning processes and we cannot change it so we still have to patch the internals.
I've thought about this problem and I think it's possible to avoid relying on process.binding.
There are 3 points were you can act:
Overwrite the internal Node bindings (current solution for spawnSync)
Overwrite the functions exported by the child_process module (≃ current solution for spawn)
Do not overwrite any functions but return a new one (requires changes in user code: does not work here)
I think that it is possible to lift the current spawnSync patch to overwrite the child_process functions instead of the process bindings. Instead of patching a single point, we'd have to patch all the child_process sync functions (execFileSync, execSync and spawnSync) but it should be doable.
What's interesting is that the 2 highest levels can be implemented together. Instead of returning the wrapper function to the user, set it on the child_process exports.
Node started to deprecate
process.binding
: https://nodejs.org/dist/latest-v11.x/docs/api/deprecations.html#deprecations_dep0111_process_bindingThis function is used by spawn-wrap to patch
spawnSync
.It is possible to avoid patching the internals at the top level by creating a wrapped
spawn
function. The main issue is caused by processes deep in the process tree: spawn-wrap tries to hook into user-code spawning processes and we cannot change it so we still have to patch the internals.There is an open Node issue discussing the issue: nodejs/node#27344
/cc @isaacs @bcoe @coreyfarrell
The text was updated successfully, but these errors were encountered: