Added OS detection for correct terminal association
[CON or /dev/tty]