Merge pull request #303 from illicitonion/ttydetection

Detect TTY based on stderr, not stdout