make the logic of tle detect more reasonable

if waitpid returns 0 then stat should not be used