diff options
author | Anton Lundin <glance@acc.umu.se> | 2013-01-18 00:25:47 +0100 |
---|---|---|
committer | Keith Winstein <keithw@mit.edu> | 2013-01-18 11:31:28 -0500 |
commit | 74e1a3094403839ebd14b39ba5dd5abf82832a74 (patch) | |
tree | aa9d6aa06ad340c4a35b26802cf27bcc03417299 | |
parent | e0dfe363a0fefab15aa461c4fce00af3b35d8adb (diff) |
Replace IO::Pty with pipe
Now when we don't need some fancy pty for sending on window-size and
reading proxy-output from, just use a regular pipe to drop dependency on
IO::Pty
[closes #378]
-rwxr-xr-x | scripts/mosh | 23 |
1 files changed, 9 insertions, 14 deletions
diff --git a/scripts/mosh b/scripts/mosh index 7d51782..a6e5b42 100755 --- a/scripts/mosh +++ b/scripts/mosh @@ -195,12 +195,6 @@ if ( scalar @ARGV < 1 ) { my $userhost = shift; my @command = @ARGV; -# Run SSH and read password -my $pty = new IO::Pty; -my $pty_slave = $pty->slave; - -$pty_slave->clone_winsize_from( \*STDIN ); - # Count colors open COLORCOUNT, '-|', $client, ('-c') or die "Can't count colors: $!\n"; my $colors = ""; @@ -218,14 +212,15 @@ if ( (not defined $colors) $colors = 0; } +my ($p_read, $p_write); +pipe($p_read, $p_write); 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; - open STDIN, "<&", $pty or die; - close $pty; + open STDOUT, ">&", $p_write or die; + open STDERR, ">&", $p_write or die; + close $p_write; + close $p_read; my @server = ( 'new', '-s' ); @@ -249,8 +244,8 @@ if ( $pid == 0 ) { # child } else { # parent my ( $ip, $port, $key ); my $bad_udp_port_warning = 0; - close $pty; - LINE: while ( <$pty_slave> ) { + close $p_write; + LINE: while ( <$p_read> ) { chomp; if ( m{^MOSH IP } ) { if ( defined $ip ) { @@ -271,7 +266,7 @@ if ( $pid == 0 ) { # child } } waitpid $pid, 0; - close $pty_slave; + close $p_read; if ( not defined $ip ) { die "$0: Did not find remote IP address (is SSH ProxyCommand disabled?).\n"; |