t / lib-terminal.shon commit Merge branch 'maint-1.7.11' into maint (e3f2675)
   1#!/bin/sh
   2
   3test_expect_success PERL 'set up terminal for tests' '
   4        # Reading from the pty master seems to get stuck _sometimes_
   5        # on Mac OS X 10.5.0, using Perl 5.10.0 or 5.8.9.
   6        #
   7        # Reproduction recipe: run
   8        #
   9        #       i=0
  10        #       while ./test-terminal.perl echo hi $i
  11        #       do
  12        #               : $((i = $i + 1))
  13        #       done
  14        #
  15        # After 2000 iterations or so it hangs.
  16        # https://rt.cpan.org/Ticket/Display.html?id=65692
  17        #
  18        if test "$(uname -s)" = Darwin
  19        then
  20                :
  21        elif
  22                "$PERL_PATH" "$TEST_DIRECTORY"/test-terminal.perl \
  23                        sh -c "test -t 1 && test -t 2"
  24        then
  25                test_set_prereq TTY &&
  26                test_terminal () {
  27                        if ! test_declared_prereq TTY
  28                        then
  29                                echo >&4 "test_terminal: need to declare TTY prerequisite"
  30                                return 127
  31                        fi
  32                        "$PERL_PATH" "$TEST_DIRECTORY"/test-terminal.perl "$@"
  33                }
  34        fi
  35'