Move our own forkpty implementation into a separate module