Code

test-terminal: set output terminals to raw mode
authorThomas Rast <trast@student.ethz.ch>
Mon, 12 Dec 2011 18:09:14 +0000 (19:09 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 19 Dec 2011 20:19:57 +0000 (12:19 -0800)
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>
t/test-terminal.perl

index ee01eb957e97594ce24a61d4cac15a3a4e5a114d..10172aee18292b50aa24b3a8694b5383c1cfd98e 100755 (executable)
@@ -69,6 +69,10 @@ if ($#ARGV < 1) {
 }
 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;