Apply patch from https://github.com/chjj/pty.js/issues/32#issuecomment-15322053