forceable-tty

0.1.0 • Public • Published

forceable-tty

Sets process.std(in/out/err).isTTY to true basing on env vars.

Usage

Include require('forcable-tty').override(); in your code. Then you can use FORCE_STDIN_TTY=1, FORCE_STDOUT_TTY=1 or FORCE_STDIN_TTY=1 env variable to get required outcome.

Example

[~/forceable-tty] echo test | ./example/example.js 
process.stdin.isTTY: undefined
process.stdout.isTTY: true
process.stderr.isTTY: true

[~/forceable-tty] echo test | FORCE_STDIN_TTY=1 ./example/example.js 
process.stdin.isTTY: true
process.stdout.isTTY: true
process.stderr.isTTY: true

Licence

license

This project is licensed under the terms of the MIT license.

Credits

This piece of code was authored by @brian-mann and @bahmutov and published in cypress under MIT license. As it solves an issue I had with testing on some CI that uses windows, I've republished it as small separate package I could use in my code. Big thanks to them!.

Readme

Keywords

none

Package Sidebar

Install

npm i forceable-tty

Weekly Downloads

17

Version

0.1.0

License

MIT

Unpacked Size

4.69 kB

Total Files

7

Last publish

Collaborators

  • tommywo