Help us understand the problem. What is going on with this article?

Git Bashのttyで怒られないように

the input device is not a TTY. If you are using mintty, try prefixing the command with 'winpty'
というメッセージを見たくない方々へ

Git bashのMinTTYがアレなのはいつものことですが、
dockerを起動したりワンライナーを書いたり、
Node.jsに標準入力を渡たしたいときに困ることがよくあります。

$ docker run -it alpine echo Hello,World
the input device is not a TTY.  If you are using mintty, try prefixing the command with 'winpty'

$ echo 'console.log("Hello,world")' | node
stdin is not a tty

解決策

bash自体をwinptyすると幸せになれます。

$ exec winpty bash

$ docker run -it alpine echo Hello,World
Hello,World

$ echo 'console.log("Hello,world")' | node
Hello,world

面倒な人は最初からbashがwinpty付きで起動するように登録しても良いかもしれません。

$ echo 'exec winpty bash' >> ~/.bash_profile

よく調べてないですが、この記事によるとデフォルトでなっていないのにはなにか理由があるみたいですね。

ちなみに.bash_profileに書く自動起動の設定を.bashrcに書き込むとbashの呼び出しが再帰して死ぬので気をつけましょう。私は死にました。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした