Skip to content
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

Coerce TTY to true when using pipe'd child processes #1126

Closed
brian-mann opened this issue Dec 24, 2017 · 2 comments
Closed

Coerce TTY to true when using pipe'd child processes #1126

brian-mann opened this issue Dec 24, 2017 · 2 comments
Assignees
Labels
type: enhancement Requested enhancement of existing feature
Milestone

Comments

@brian-mann
Copy link
Member

Per this repo: https://github.com/cypress-io/cypress-test-tty

And these CI providers: https://circleci.com/gh/cypress-io/cypress-test-tty and https://travis-ci.org/cypress-io/cypress-test-tty

Because we pipe the output of stdout and stderr when spawning the electron process from the CLI - this causes process.stdout.isTTY and tty.isatty(1) to be false.

Although this is technically true, since we are the ones controlling the piped process, we really want it to be have as a correctly "inherited" child process - which would then cause the checks for tty to be true.

This is important as terminal packages like chalk or mocha depend on this to figure out whether they should output colors, and additionally how to write things like new lines, etc.

To fix this, we need to monkey patch the isTTY property and override tty.isatty to force these values to be true.

@brian-mann brian-mann added the type: enhancement Requested enhancement of existing feature label Dec 24, 2017
@brian-mann brian-mann self-assigned this Dec 24, 2017
@brian-mann brian-mann added this to the 1.4.1 milestone Dec 24, 2017
brian-mann added a commit that referenced this issue Dec 25, 2017
…r when xvfb exits with status code 1, force tty in linux, handle colors in windows, enable logging cypress:xvfb stderr

* cli: fixes #838 start cypress in dev by routing through the CLI

- matches how we run in production better to keep parity and consistency

* cli: add coerceFalse for clarity

* cli: add global flag, update to work with windows

* server: bring into parity with root scripts

* cli: just execute start script directly to work with windows

* cli: if colors are supported then force them via env vars

- this fixes windows not displaying colors from electron because by
default isTTY is false (due to electron)

* cli: fixes #921 don't ignore stderr, inherit stdio on everything except when linux + xvfb

- filter out stderr messages coming from Xlib or libudev (from xvfb)

* cli, server: force stderr tty so that normalize tty behavior when piping

* server: drop in supports color so debug outputs more colors!

* server: remove empty line

* root: refer to cypress not monorepo

* cli: make util.supportsColor return boolean

* cl: add tests around spawn behavior with forcing colors, tty, and stdio configuration

* cli: handle xvfb onStderrData callback to output debug information

* cli: handle non zero exit code error from xvfb with special message
@brian-mann
Copy link
Member Author

Fixed by #1120.

@brian-mann
Copy link
Member Author

Released in 1.4.1.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: enhancement Requested enhancement of existing feature
Projects
None yet
Development

No branches or pull requests

1 participant