Skip to content

Commit

Permalink
test-terminal: set output terminals to raw mode
Browse files Browse the repository at this point in the history
Not setting them to raw mode causes funny things to happen, such as
\n -> \r\n translation:

  ./test-terminal.perl echo foo | xxd
  0000000: 666f 6f0d 0a                             foo..

(Notice the added 0d.)

To avoid this, set the (pseudo)terminal to raw mode.  Note that the
IO::Pty docs recommend doing it on both master and slave.

Signed-off-by: Thomas Rast <trast@student.ethz.ch>
Acked-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
  • Loading branch information
Thomas Rast authored and Junio C Hamano committed Dec 19, 2011
1 parent 0510480 commit a463aef
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions t/test-terminal.perl
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ sub copy_stdio {
}
my $master_out = new IO::Pty;
my $master_err = new IO::Pty;
$master_out->set_raw();
$master_err->set_raw();
$master_out->slave->set_raw();
$master_err->slave->set_raw();
my $pid = start_child(\@ARGV, $master_out->slave, $master_err->slave);
close $master_out->slave;
close $master_err->slave;
Expand Down

0 comments on commit a463aef

Please sign in to comment.