If we can't grab the terminal in interactive mode, give
up after 100 goes. This is a completely arbitrary choice;
we simply don't know what in the system could change the
result of looping further.
Indentatin in moveto was broken by 3eea35d0 (my bad), making it
difficult to read. This commit reverts it to what it used ot be.
While at it, fix indentation in a few other places in the same
file.
When TTY disappears and there is at least one fd watcher, raw_getbyte() can
enter an infinite loop where it keeps calling poll() over and over again.
To reproduce, open a terminal, start zsh and type this:
rm -f /tmp/fifo
mkfifo /tmp/fifo
exec 3<>/tmp/fifo
do-nothing() {}
zle -F 3 do-nothing
Then make TTY disappear. For example, kill the parent with `kill -9 $PPID`
and close the terminal window if it's still there. Observe that zsh is
consiming 100% CPU. Note that do-nothing() never gets called.
This patch makes the poll() loop in raw_getbyte() terminate when TTY is
signalling POLLHUP. This makes the behavior consistent with the case where
TTY disappears while no fd watchers are installed.
Using ".PHONY" might actually execute (phony) targets then, while
"--always-make" triggers processing of all targets, respecting `-n`
(`--dry-run`).
(This can be seen with `make -nsp .PHONY` in
https://github.com/neomake/neomake/tree/76b110d49a, where it actually
causes infinite processing then)
".PHONY" was used since the beginning here (37012f06a [1]).
As for bmake (which also uses `.PHONY`): there does not appear to be a
similar option for it.
While it might work better there (i.e. not causing targets to be run),
it causes an error at least when testing it quickly - which indicates
that it behaves as if using any other non-existing (or special) target
there maybe:
> bmake: don't know how to make .PHONY. Stop
This was added in ecc0a5ece [2] (workers-39654).
Since it uses `-s -f "$file" -V.ALLTARGETS` with `bmake` before to get
targets explicitly, there might not be a reason for calling `bmake` with
`-nsdg1Fstdout … .PHONY` additionally in the first place?!
1: https://github.com/danielshahaf/zsh/commit/37012f06a
2: https://github.com/danielshahaf/zsh/commit/ecc0a5ece