force-stdin-tty
Force stdin to be assigned to /dev/tty
Install
Using npm:
npm install --save-dev force-stdin-tty
or using yarn:
yarn add force-stdin-tty --dev
Usage
This package can be used to force git hooks to allow prompts for user input. If the user is using a UI and not a terminal, you can tell them to use a terminal. See this stackoverflow question.
; let overwroteStdin = false;try overwroteStdin = ; catch console; process; if overwroteStdin processstdin;
husky
support
This package works with husky
.
husky
initially did add support for stdin,
but later removed it due to a Windows bug:
The husky
author suggests using the undocumented ~/.huskyrc
to enable prompts
for git hooks. But it isn't ideal because each developer would have to enable it.
See:
TypeScript support
This package supports TypeScript.