jig fails with "No such device or address: /dev/tty" when run non-interactively (such as via IntelliJ)
The /dev/tty file does not exist in non-interactive executions (at least on this platform), such as when git is invoked by IntelliJ. Stack trace:
Error:Traceback (most recent call last):
File ".git/hooks/pre-commit", line 16, in <module>
jig.fromhook(join(dirname(__file__), '..', '..'))
File "/usr/local/lib/python2.7/dist-packages/jig/runner.py", line 59, in fromhook
return self.main(gitrepo)
File "/usr/local/lib/python2.7/dist-packages/jig/runner.py", line 73, in main
sys.stdin = open('/dev/tty')
IOError: [Errno 6] No such device or address: '/dev/tty'
during executing git commit --only -F /tmp/git-commit-msg-2470693301936460247.txt -- .gitignore
My preferred resolution to this problem would be to remove any TTY dependencies from jig entirely. jig would be more easily integrated into non-trivial git workflows if interactive prompts were removed entirely and replaced with advisory messages. For example, rather than prompting the user to upgrade, it could merely print a warning that an upgrade is available and tell the user what command to run to get the upgrade.
Platform: Ubuntu 14.04.
I agree. Jig shouldn't use a tty if it's not there. I'll add some detection so that this doesn't fail.