Handle case of no controlling terminal semi-gracefully. There's probably a better way of determining whether there's a controlling tty but this'll do for now.