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
Dumb terminal when piping input to console app disallows ANSI formatting #299
Comments
No, I think the problem comes from the fact that JLine does not support having 2 different terminal types for the input and the output. In your case, the input is not a real terminal, but the output is. |
JLine |
…ut/output (#24855) Allow for a dumb terminal as a fallback if no system terminal detected in the hz-cli input or output. Fixes: https://hazelcast.atlassian.net/browse/HZ-2610 Also see: - jline/jline3#291 (comment) - jline/jline3#299 Testing: - build local docker image using script (https://hazelcast.slack.com/archives/C01MH9KF1QT/p1657111661829299): `DOCKER_TAG=test ./build-docker-image.sh` - run the container: `docker run -it --rm --name hz-test hazelcast:test` - start container shell: `docker exec -it hz-test sh` - exec hz-cli with piped input: `echo exit\n | hz-cli sql` Before: ``` $ docker exec -it hz-test sh /opt/hazelcast $ echo exit\n | hz-cli sql 10:45:18.310 [ WARN] [o.jline] Unable to create a system terminal, creating a dumb terminal (enable debug logging for more information) Connected to Hazelcast 5.3.0 at [172.17.0.2]:5701 (+0 more) Type 'help' for instructions sql> Exiting from SQL console ``` After: no jline warning ``` $ docker exec -it hz-test sh /opt/hazelcast $ echo exit\n | hz-cli sql Connected to Hazelcast 5.4.0 at [172.17.0.3]:5701 (+0 more) Type 'help' for instructions sql> Exiting from SQL console ``` Breaking changes (list specific methods/types/messages): * API * client protocol format * serialized form * snapshot format Checklist: - [x] Labels (`Team:`, `Type:`, `Source:`, `Module:`) and Milestone set - [x] Label `Add to Release Notes` or `Not Release Notes content` set - [x] Request reviewers if possible - [x] Send backports/forwardports if fix needs to be applied to past/future releases - [x] New public APIs have `@Nonnull/@Nullable` annotations - [x] New public APIs have `@since` tags in Javadoc
When I pipe input to CommandBox like so:
Then the JLine uses a dumb terminal which prevents the commands from using any ANSI formatting, even though I may be running inside of a terminal that is fully capable of 256 colors, etc. It is correct that JLIne uses a dumb terminal in this situation?
The text was updated successfully, but these errors were encountered: