Fix spinners in a very specific way to make emacs happy
commitedc4833038bc041a2a9f59e52089455b2c0f0801
authorKasper Kopec <kasper@fb.com>
Fri, 30 Mar 2018 02:35:19 +0000 (29 19:35 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Fri, 30 Mar 2018 02:38:41 +0000 (29 19:38 -0700)
tree81688619f056da377b8aed00d234c23135ca9e0f
parent64725c7bacc984306efa6c26a31055091b0ca5b2
Fix spinners in a very specific way to make emacs happy

Summary:
Before D7207801 we could either just print `<result>` immediately or (if things take time) print `<spinner>(wait 1 s)<magical control characters to remove old spinner><spinner>(wait 1 s)<control character>...<result>`

After D7207801, the first option got replaced by `<spinner><control characters><result>` (without the wait.) This should be functionally equivalent to just `<result>`, and command line terminal handles it correctly, but it seems that emacs pretends to be a terminal (in a way that makes our Unix.isatty check pass), while not actually handling those control characters correctly.

Note that this was already always broken, and will keep being broken in some cases - if the command takes more than 1 second to answer, the spinners and control characters will be printed out. D7207801 just made it happen for all commands, not only the slow ones.

IMHO something really should be fixed on the emacs plugin side, but I'll maintain the previous behavior to not break it even more.

Reviewed By: gregory-nisbet

Differential Revision: D7441847

fbshipit-source-id: 2a6798a8c2a0bca145dd72762ac20c571185ef40
hphp/hack/src/client/clientConnect.ml