-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
CLI incorrectly assumes non-interactive mode #4607
Comments
Re-posting from #4425 (comment):
AFAICT, when I run tests with stdin read from Few examples (executed from
|
In our last estimation meeting we had several doubts about this story. The most important question was,
cc: @bajtos |
IIRC, some shells (Windows However, I don't think it's necessary to auto-detect "JSON via stdin" scenario. Personally, I prefer tools to be explicit and have a special combinations of CLI arguments to enable this mode. AFAICT from reading the source code, the following invocations is already supported and should work well:
As I see it, the problem is caused by the following invocation that is also supported but the implementation is brittle:
The goal of this story is to make CLI tests more robust and easier to debug in a debugger. I'd like to fix the following two use cases:
IMO, the ability to paste the config JSON content into terminal should be preserved when the CLI is invoked via What may change as a result of fixing the behavior: at the moment, the following command is triggering a non-interactive mode where the CLI is expecting JSON data in stdin:
Without the current auto-detection, this may no longer work and users may need to call I am proposing to remove the code checking
@raymondfeng IIRC, you had strong opinions about Essentially, I want our test suite to pass when it's executed via I re-run the example scenarios described in #4607 (comment) and confirm that they still work the same way. Executed from
Executed from monorepo root:
|
What's the use case behind |
It seems that GitHub Actions are running scripts this way, see #5110 (comment) |
On the second thought, the purpose of |
Our CLI app allows users to provide prompt answers in multiple ways:
name
.--config
option.stdin
At the moment, the logic determining when to read data from
stdin
is based onprocess.stdin.isTTY
flag. Unfortunately, this is often causing confusing behavior.stdin
stream is in non-TTY mode. As a result, CLI uses different way (code path) to prompt for options.stdin
stream is available and in TTY mode. When running the tests withstdin
disabled (e.g. vianpm 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.
The text was updated successfully, but these errors were encountered: