COOK-538 Copy pseudotty disable code from Google

More info at https://issues.cask.co/browse/COOPR-538