W dniu 29.09.2016 o 13:57, Torsten Bögershausen pisze: 
> On 29/09/16 12:28, Lars Schneider wrote:

>> This is what happens:
>>
>> 1) Git exits
>> 2) The filter process receives EOF and prints "STOP" to the log
>> 3) t0021 checks the content of the log
>>
>> Sometimes 3 happened before 2 which makes the test fail.
>> (Example: https://travis-ci.org/git/git/jobs/162660563 )
>>
>> I added a this to wait until the filter process terminates:
>>
>> +wait_for_filter_termination () {
>> +    while ps | grep -v grep | grep -F "/t0021/rot13-filter.pl" >/dev/null 
>> 2>&1
>> +    do
>> +        echo "Waiting for /t0021/rot13-filter.pl to finish..."
>> +        sleep 1
>> +    done
>> +}
>>
>> Does this look OK to you?
> Do we need the ps at all ?
> How about this:
> 
> +wait_for_filter_termination () {
> +    while ! grep "STOP"  LOGFILENAME >/dev/null
> +    do
> +        echo "Waiting for /t0021/rot13-filter.pl to finish..."
> +        sleep 1
> +    done
> +}

Or even better: make filter driver write its pid to pidfile, and then
"wait $(cat rot13-filter.pid)".  That's what we do in lib-git-daemon.sh
(I think).

If the problem is exit status of "wait" builtin, then filter driver
can remove its pidfile after writing "STOP", just before ending.

-- 
Jakub Narębski

Reply via email to