Skip to content

CLI incorrectly assumes non-interactive mode #4607

@bajtos

Description

@bajtos

Our CLI app allows users to provide prompt answers in multiple ways:

  • Some values can be configured via CLI arguments and options, e.g. name.
  • It is possible to provide JSON object with values to all prompts via --config option.
  • It is possible to stream a JSON object to stdin

At the moment, the logic determining when to read data from stdin is based on process.stdin.isTTY flag. Unfortunately, this is often causing confusing behavior.

  • When debugging our CLI tool via Visual Studio Code, application's stdin stream is in non-TTY mode. As a result, CLI uses different way (code path) to prompt for options.
  • The outcome of our test suite depends on whether the stdin stream is available and in TTY mode. When running the tests with stdin disabled (e.g. via npm test < /dev/null), many of the tests fail.

I would like us to improve the logic deciding how to prompt for options and make it more robust, less suspect to different ways how CLI can be legitimately invoked.

Acceptance Criteria

To be added by the team after discussing with @bajtos.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions