Code

tests: Fix race condition in t7006-pager
authorJonathan Nieder <jrnieder@gmail.com>
Mon, 22 Feb 2010 08:46:33 +0000 (02:46 -0600)
committerJunio C Hamano <gitster@pobox.com>
Mon, 22 Feb 2010 22:19:28 +0000 (14:19 -0800)
commit8c33b4cf67f47ee46fe0984751fd40c4cf7cf392
tree6d9e4d65b289b81558de3a57f9adc16a979742d6
parent2d3ca21677597902f66bf2f2b2cf1b4a623f1e4f
tests: Fix race condition in t7006-pager

Pagers that do not consume their input are dangerous: for example,

 $ GIT_PAGER=: git log
 $ echo $?
 141
 $

The only reason these tests were able to work before was that
'git log' would write to the pipe (and not fill it) before the
pager had time to terminate and close the pipe.

Fix it by using a program that consumes its input, namely wc (as
suggested by Johannes).

Reported-by: Johannes Sixt <j.sixt@viscovery.net>
Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
t/t7006-pager.sh