make sure to write all to terminal fd even if write ends early due to TTY buffer full