Don't assume the shell's controlling terminal is attached to file descriptor 2. Instead, open /dev/tty. This problem stopped commands in subshells from being executed correctly if standard error was redirected.
Don't assume the shell's controlling terminal is attached to file descriptor
2. Instead, open /dev/tty. This problem stopped commands in subshells from
being executed correctly if standard error was redirected.

PR:		36671
Obtained from:	NetBSD (but simplified)

jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase,jrobhoward/SCADAbase