Skip to content

--check flag doesn't always prevent execution #11680

Closed
@atg

Description

@atg
  • Version: all
  • Platform: all
  • Subsystem: internal/bootstrap_node.js
-c, --check
       Syntax check the script without executing.

The node --check flag is supposed to check syntax and then stop. However, as currently implemented the --check flag is ignored if the script to be checked is given via stdin or via -e flag; and the script is executed regardless.

For instance:

$ echo 'console.log("hello")' | node --check

$ node --check -e 'console.log("hello")'
  • Expected behaviour: nothing prints (but any syntax errors are reported)
  • Actual behaviour: "hello" is printed to stdout in both cases

Metadata

Metadata

Assignees

No one assigned

    Labels

    cliIssues and PRs related to the Node.js command line interface.confirmed-bugIssues with confirmed bugs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions