This is likely happens because Swift's Process
uses posix_spawn(2), which has no support for setting terminal process group TPGID, at least on Darwin.
An easy fix would be to call tcsetpgrp(3) after process.run()
as follows:
tcsetpgrp(STDIN_FILENO, process.processIdentifier)
See macos - Process cannot read from the standard input in Swift - Stack Overflow for more details.