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

Re: [PATCH v4 7/7] t7006-pager: if stdout is not a terminal, make a new one

From
Jeff King <peff@peff.net>
Date
Feb 21, 2010, 07:30 UTC
Message-ID
<20100221073058.GC2840@coredump.intra.peff.net>
In-Reply-To
<20100221020922.GB7651@progeny.tock>
On Sat, Feb 20, 2010 at 08:09:22PM -0600, Jonathan Nieder wrote:
Show 18 quoted lines
> Testing pagination requires (fake or real) access to a terminal so we
> can see whether the pagination automatically kicks in, which makes it
> hard to get good coverage when running tests without --verbose.  There
> are a number of ways to work around that:
> 
>  - Replace all isatty calls with calls to a custom xisatty wrapper
>    that usually checks for a terminal but can be overridden for tests.
>    This would be workable, but it would require implementing xisatty
>    separately in three languages (C, shell, and perl) and making sure
>    that any code that is to be tested always uses the wrapper.
> 
>  - Redirect stdout to /dev/tty.  This would be problematic because
>    there might be no terminal available, and even if a terminal is
>    available, it might not be appropriate to spew output to it.
> 
>  - Create a new pseudo-terminal on the fly and capture its output.
> 
> This patch implements the third approach.

Just to wrap up my end of this patch discussion, I think the approach you take here is the sanest one. While it would be nice to get test coverage on every system, I don't think it is worth the effort of trying to write portable terminal creation code. And this way at least the code in git is fairly minimal.

So looks good to me.
-Peff
Previous: Jonathan NiederNext: Johannes Sixt
Message 11 of 26 in “Re: 'git svn log' no longer uses the pager”
  1. 0/7 Re: 'git svn log' no longer uses the pagerJonathan Nieder, Feb 19, 2010
  2. 1/7 Fix 'git var' usage synopsisJonathan Nieder, Feb 19, 2010
  3. 2/7 Make 'git var GIT_PAGER' always print the configured pagerJonathan Nieder, Feb 19, 2010
  4. 3/7 git.1: Clarify the behavior of the --paginate optionJonathan Nieder, Feb 19, 2010
  5. 4/7 git svn: Fix launching of pagerJonathan Nieder, Feb 19, 2010
  6. 5/7 am: Fix launching of pagerJonathan Nieder, Feb 19, 2010
  7. 6/7 tests: Add tests for automatic use of pagerJonathan Nieder, Feb 19, 2010
  8. Junio C HamanoFeb 20, 2010
  9. 6/7 tests: Add tests for automatic use of pagerJonathan Nieder, Feb 21, 2010
  10. 7/7 t7006-pager: if stdout is not a terminal, make a new oneJonathan Nieder, Feb 21, 2010
  11. Jeff KingFeb 21, 2010
  12. Johannes SixtFeb 22, 2010
  13. 8/7 tests: Fix race condition in t7006-pagerJonathan Nieder, Feb 22, 2010
  14. Jonathan NiederFeb 22, 2010
  15. 7/7 t7006-pager: if stdout is not a terminal, make a new oneJonathan Nieder, Feb 19, 2010
  16. Jeff KingFeb 19, 2010
  17. Jonathan NiederFeb 19, 2010
  18. Jeff KingFeb 19, 2010
  19. Brandon CaseyFeb 19, 2010
  20. Brandon CaseyFeb 20, 2010
  21. Jonathan NiederFeb 20, 2010
  22. Brandon CaseyFeb 20, 2010
  23. 7/7 t7006-pager: if stdout is not a terminal, make a new oneJonathan Nieder, Feb 20, 2010
  24. Junio C HamanoFeb 20, 2010
  25. 7/7 t7006-pager: if stdout is not a terminal, make a new oneJonathan Nieder, Feb 20, 2010
  26. Simplify test-terminal.perlJonathan Nieder, Feb 20, 2010

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.