my ($in, $out, $pid) = $ssh->open2({tty => 1}, "tail -f /foo/bar"); ... kill TERM => $pid; waitpid $pid, 0; close $in; close $out;