Skip to content

node -e invocation that doesn't mention sys yields deprecation warning #40871

Open
@cemerick

Description

@cemerick

Version

v17.1.0

Platform

Linux t440p 5.4.0-89-generic #100-Ubuntu SMP Fri Sep 24 14:50:10 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Subsystem

No response

What steps will reproduce the bug?

$ node --version
v17.1.0
$ node --trace-deprecation -e 'let env = (function () { return Object.getOwnPropertyNames(this).reduce((g, k) => { g[k] = this[k]; return g }, { }) })();'
(node:465563) [DEP0025] DeprecationWarning: sys is deprecated. Use util instead.
    at node:sys:28:9
    at NativeModule.compileForInternalLoader (node:internal/bootstrap/loaders:312:7)
    at NativeModule.compileForPublicLoader (node:internal/bootstrap/loaders:252:10)
    at loadNativeModule (node:internal/modules/cjs/helpers:49:9)
    at Function.Module._load (node:internal/modules/cjs/loader:804:15)
    at Module.require (node:internal/modules/cjs/loader:999:19)
    at get (node:internal/modules/cjs/helpers:175:33)
    at [eval]:1:96
    at Array.reduce (<anonymous>)
    at [eval]:1:66

How often does it reproduce? Is there a required condition?

Always reproducible.

What is the expected behavior?

No deprecation warning,

What do you see instead?

No response

Additional information

The provided code:

  1. doesn't reference sys, and uses no libraries
  2. loads and runs fine when put into a source file or loaded from stdin:
$ node - <<END
let env = (function () { return Object.getOwnPropertyNames(this).reduce((g, k) => { g[k] = this[k]; return g }, { }) })();
END
$

Metadata

Metadata

Assignees

No one assigned

    Labels

    deprecationsIssues and PRs related to deprecations.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions