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

Forking with anything besides inherit causes stdio not to be a TTY. #1

Open
jamestalmage opened this issue May 31, 2016 · 1 comment

Comments

@jamestalmage
Copy link

Most CLI's expect (TTY.isatty())[https://nodejs.org/api/tty.html#tty_tty_isatty_fd], and process.stdout.isTTY to return true. It's conceivable they will behave differently when those return false (a well designed CLI probably should).

This complicates things. Some people have tried to develop pty support for node. AVA itself fakes TTY support in forked processes here.

Both approaches have significant downsides.

  • pty requires native components and a build step, and so is inherently fragile for cross-platform development.
  • AVA's approach requires you execute code before the forked process runs. It's not a problem for AVA, since we're doing that to set up the test environment anyways, but would be harder for a general use library. Also, it only works for CLI's written in Node.
@arve0
Copy link
Owner

arve0 commented May 31, 2016

Thanks for reporting 👍 Did not know that TTY was that complicated, naive approach here 😅

I'll note this in the README. At least it works for inherited forks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants