-
-
Notifications
You must be signed in to change notification settings - Fork 18
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
fix: Remove legacy spawnSync
feature detection
#87
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Sorry I was out earlier didn't get a chance to review this. process.binding is silently deprecated in current versions of node.js, this change assumes it will never be removed. Is that a good idea?
// @bcoe @demurgos
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.
I remember reading about possible deprecations but haven't heard more about it. Do you know how soon it may be deprecated? Node 13? Node 14?
Generally, I don't like that this library use Node's internals and monkey-patches them because it is fragile and has bad encapsulation. It is possible to patch the
spawn
function at a higher level: I would prefer to move into this direction. The internal patching could be kept for the moment, but ultimately I'd like to deprecate it. This progression would be similar tograceful-fs
: it initially patched Node's internals but then moved to an "external wrapper" design.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.
process.binding
hit 'documentation only' deprecation in 10.9.0. Since 11.12.0 it is a 'pending deprecation', sonode --pending-deprecation
will show a warning. I don't have any information on when it will be escalated to full deprecation. I raised this module as a potential issue at nodejs/node#27344. I'm not entirely sure the 'external wrapper' way of graceful-fs will really work, the idea is to 'hijack' calls to spawn / spawnSync. Maybe theNODE_OPTIONS
environment will work, I haven't had a chance to give that much thought yet.https://nodejs.org/dist/latest-v11.x/docs/api/deprecations.html#DEP0111
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.
Oh, thank you very much for the info: I wasn't aware that it already started being deprecated.
An external wrapper would be a function that changes the options and then passes them to
require("child_process").spawn
, without ever changing the internals. But it only solves the issue at the top level. To wrap processes deep in the process tree (and hooking into code you don't control) I still patch the internals.It's a tough problem.
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.
I opened an issue to discuss this deprecation: #89