Subject: | make_slave_controlling_terminal is not called, breaking /dev/tty |
Date: | Fri, 20 Sep 2013 16:16:41 +0200 |
To: | bug-IPC-Run [...] rt.cpan.org |
From: | "A.N." <ailin [...] devio.us> |
IPC::Run does not call make_slave_controlling_terminal, so programs
which need a real controlling terminal will fail. For example, Emacs
just states "Could not open file: /dev/tty"
This bug has also been noticed on
http://www.perlmonks.org/bare/?node_id=581512
It severly impacts the usefulness of IPC::Run as an Expect replacement.
The following fix should be applied:
--- IPC/Run.pm 2012-08-30 17:22:46.000000000 +0200
+++ IPC/Run.pm 2013-09-20 16:03:40.891568790 +0200
@@ -2557,6 +2557,7 @@ sub _do_kid_and_exit {
## Clean up the parent's fds.
for ( keys %{$self->{PTYS}} ) {
_debug "Cleaning up parent's ptty '$_'" if _debugging_details;
+ $self->{PTYS}->{$_}->make_slave_controlling_terminal;
my $slave = $self->{PTYS}->{$_}->slave;
$closed[ $self->{PTYS}->{$_}->fileno ] = 1;
close $self->{PTYS}->{$_};
Thanks!