Skip to content

ANSI escape sequences are not stripped when stdout is redirected in cygwin. #179

@tyan0

Description

@tyan0

Overview

JANSI current git head (2.0.2-SNAPSHOT) failed to strip ANSI escape sequences when stdout is redirected in cygwin. Escape sequences in output of JANSI is expected to be enabled only when stdout is a TTY. However, current git head (2.0.2-SNAPSHOT) outputs escape sequences even when stdout is redirected to non-TTY in cygwin.

How to reproduce

  1. Install Maven.
  2. Replace JANSI with 2.0.2-SNAPSHOT.
  3. Execute mvn | less under cygwin.

Expected result

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.093 s
[INFO] Finished at: 2020-12-02T12:44:16+09:00
[INFO] ------------------------------------------------------------------------
[ERROR] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
:

Actual result

[ESC[1;34mINFOESC[m] Scanning for projects...
[ESC[1;34mINFOESC[m] ESC[1m------------------------------------------------------------------------ESC[m
[ESC[1;34mINFOESC[m] ESC[1;31mBUILD FAILUREESC[m
[ESC[1;34mINFOESC[m] ESC[1m------------------------------------------------------------------------ESC[m
[ESC[1;34mINFOESC[m] Total time:  0.082 s
[ESC[1;34mINFOESC[m] Finished at: 2020-12-02T12:38:26+09:00
[ESC[1;34mINFOESC[m] ESC[1m------------------------------------------------------------------------ESC[m
[ESC[1;31mERRORESC[m] No goals have been specified for this build. You must specify a valid lifecycle phase or a goal in the format <plugin-prefix>:<goal> or <plugin-group-id>:<plugin-artifact-id>[:<plugin-version>]:<goal>. Available lifecycle phases are: validate, initialize, generate-sources, process-sources, generate-resources, process-resources, compile, process-classes, generate-test-sources, process-test-sources, generate-test-resources, process-test-resources, test-compile, process-test-classes, test, prepare-package, package, pre-integration-test, integration-test, post-integration-test, verify, install, deploy, pre-clean, clean, post-clean, pre-site, site, post-site, site-deploy. -> ESC[1m[Help 1]ESC[m
[ESC[1;31mERRORESC[m]
[ESC[1;31mERRORESC[m] To see the full stack trace of the errors, re-run Maven with the ESC[1m-eESC[m switch.
[ESC[1;31mERRORESC[m] Re-run Maven using the ESC[1m-XESC[m switch to enable full
:

The cause

I guess this is related to: fusesource/jansi-native#23

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions