The call to tcgetattr may fail with ENOTTY, leaving the struct possibly uninitialized (UB).
Fix this UB by returning early when isatty fails, or when tcgetattr fails. (Same for Windows)
This can be tested by a command that fails valgrind before the change and passes after:
0echo 'pipe' | valgrind --quiet ./bld-cmake/bin/bitcoin-cli -stdinrpcpass uptime