-
Notifications
You must be signed in to change notification settings - Fork 29.6k
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
process: Add code to warnings, assign codes to deprecations #10116
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -121,6 +121,16 @@ added: v6.0.0 | |
|
||
Print stack traces for process warnings (including deprecations). | ||
|
||
### `--redirect-warnings=file` | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not terribly convinced this is useful enough to justify.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, docs don't say whether file is created or not, or whether it is appended to, or replaces the file. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The idea for this came up during the collaborator summit and was specifically around finding a more intelligent way to handle deprecation warnings that are emitted when using tools like npm. When doing installs, it still may be necessary to capture This can be configured by environment variable. The envvar is included in this PR. The file is created if it does not already exist. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, missed the env var version, with that I'm only I was present in that conversation, and I don't think this addresses the experience of node users. When doing npm installs, the only code that runs is npm's, so its not clear to me why we would want to silence the deprecation warnings. npm should just fix any of their deps to not cause these warnings, they are responsible citizens, they do that. When using modules installed by npm, then I guess we don't care, usually, and can't do anything about them as a consumer of the module (other than report bugs). But, this redirect doesn't distringuish between deprecation warnings from our dependencies, and deprecations from out code itself, and node can't distinguish, it doesn't really know. I think in the future it will look like an ad-hoc hack to deal with a more general problem, and we'll have to keep it around for a long time until we deprecate it. That said, I am not prepared to argue more strongly against it. If noone else chimes in to object, its OK by me. |
||
<!-- YAML | ||
added: REPLACEME | ||
--> | ||
|
||
Write process warnings to the given file instead of printing to stderr. The | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What can you pass to this? Could you pass a fd number and theoretically print these to "stdio 3" (even though that isn't default functionality, it could conceivably be made workable)? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A filepath only (absolute or relative). We could theoretically allow for an fd number but not sure if making it more complicated is worth it.... not out of the question tho. |
||
file will be created if it does not exist, and will be appended to if it does. | ||
If an error occurs while attempting to write the warning to the file, the | ||
warning will be written to stderr instead. | ||
|
||
### `--trace-sync-io` | ||
<!-- YAML | ||
added: v2.1.0 | ||
|
@@ -395,6 +405,17 @@ Note: Be aware that unless the child environment is explicitly set, this | |
evironment variable will be inherited by any child processes, and if they use | ||
OpenSSL, it may cause them to trust the same CAs as node. | ||
|
||
### `NODE_REDIRECT_WARNINGS=file` | ||
<!-- YAML | ||
added: REPLACEME | ||
--> | ||
|
||
When set, process warnings will be emitted to the given file instead of | ||
printing to stderr. The file will be created if it does not exist, and will be | ||
appended to if it does. If an error occurs while attempting to write the | ||
warning to the file, the warning will be written to stderr instead. This is | ||
equivalent to using the `--redirect-warnings=file` command-line flag. | ||
|
||
[emit_warning]: process.html#process_process_emitwarning_warning_name_ctor | ||
[Buffer]: buffer.html#buffer_buffer | ||
[debugger]: debugger.html | ||
|
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.
nit: maybe use the same word in the file name and the section name? I.e.
deprecated.md/html
or evendeprecated-apis.md/html
?