Skip to content

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

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions