Subprocess handling through PTYs