Permalink
Browse files

Reverse the direction of the IO::Pty used for ssh.

May address #114.
May address #164.
  • Loading branch information...
1 parent bcb96d9 commit fe8e50de2bc101989b0ce78f8942b9b5ea89346b @saurik saurik committed with keithw Apr 16, 2012
Showing with 4 additions and 5 deletions.
  1. +4 −5 scripts/mosh
View
9 scripts/mosh
@@ -192,10 +192,10 @@ if ( (not defined $colors)
my $pid = fork;
die "$0: fork: $!\n" unless ( defined $pid );
if ( $pid == 0 ) { # child
+ $pty->close_slave();
+ open STDOUT, ">&", $pty or die;
+ open STDERR, ">&", $pty or die;
close $pty;
- open STDOUT, ">&", $pty_slave->fileno() or die;
- open STDERR, ">&", $pty_slave->fileno() or die;
- close $pty_slave;
my @server = ( 'new', '-s' );
@@ -218,8 +218,7 @@ if ( $pid == 0 ) { # child
die "Cannot exec ssh: $!\n";
} else { # server
my ( $ip, $port, $key );
- $pty->close_slave();
- LINE: while ( <$pty> ) {
+ LINE: while ( <$pty_slave> ) {
chomp;
if ( m{^MOSH IP } ) {
( $ip ) = m{^MOSH IP (\S+)\s*$} or die "Bad MOSH IP string: $_\n";

0 comments on commit fe8e50d

Please sign in to comment.