Why travis failed in master branch, but successed in PR

Regarding the OP’s issue, this does seem to be a user script error.

A workaround for losing output is to avoid producing very much output very quickly like the coverage file dump:

then you should be able to see the output from where the error happens and diagnose it.