git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH 2/3] test-terminal: set output terminals to raw mode

From
Thomas Rast <trast@student.ethz.ch>
Date
Dec 12, 2011, 18:09 UTC
Message-ID
<04a77f48dd5d5afebbe625ed25ebecd57b6a8840.1323713230.git.trast@student.ethz.ch>
In-Reply-To
<b97d14da67bd6097e5b04f6ae3057c0f1d536a0b.1323713230.git.trast@student.ethz.ch>

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>
---
 t/test-terminal.perl |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/t/test-terminal.perl b/t/test-terminal.perl
index 87b5a8c..a2bfbe5 100755
--- a/t/test-terminal.perl
+++ b/t/test-terminal.perl
@@ -81,6 +81,10 @@ sub set_default_eof_char {
 my $master_in = new IO::Pty;
 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();
 set_default_eof_char($master_in->slave);
 my $pid = start_child(\@ARGV, $master_in->slave, $master_out->slave, $master_err->slave);
 close $master_in->slave;
-- 
1.7.8.431.g2abf2
Previous: Thomas RastNext: Jonathan Nieder
Message 2 of 16 in “test-terminal: give the child an empty stdin TTY”
  1. 1/3 test-terminal: give the child an empty stdin TTYThomas Rast, Dec 12, 2011
  2. 2/3 test-terminal: set output terminals to raw modeThomas Rast, Dec 12, 2011
  3. Jonathan NiederDec 12, 2011
  4. Thomas RastDec 12, 2011
  5. Jonathan NiederDec 13, 2011
  6. 3/3 t/lib-terminal: test test-terminal's sanityThomas Rast, Dec 12, 2011
  7. Jonathan NiederDec 12, 2011
  8. Jonathan NiederDec 12, 2011
  9. Thomas RastDec 12, 2011
  10. Jonathan NiederDec 12, 2011
  11. Junio C HamanoDec 12, 2011
  12. Junio C HamanoDec 12, 2011
  13. Thomas RastDec 12, 2011
  14. Jeff KingDec 12, 2011
  15. Junio C HamanoDec 12, 2011
  16. Jonathan NiederDec 12, 2011

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.