gs_cache: bugfix when list members of a broken tar file

In some special cases, the tar file from upstream may be broken. If we
don't close the input of tar command in this case, the tar command, as
well as the connection, will hang for ever. This can cause cascade
issues to gs_cache due to connection leaking.

BUG=None
TEST=Deployed to chromeos2-devserver6 and:
 1. Construct a fake broken tar file for /download RPC
 2. Verify that the /list_member will hang w/o this CL.
 3. Apply this CL.
 4. Verify that the /list_member will terminate (though the output is
     not complete)

Change-Id: I89c4eeb1b77376983653a72567a9ea3fa2a14299
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/dev-util/+/2337399
Commit-Queue: Congbin Guo <guocb@chromium.org>
Commit-Queue: Sanika Kulkarni <sanikak@chromium.org>
Tested-by: Congbin Guo <guocb@chromium.org>
Auto-Submit: Congbin Guo <guocb@chromium.org>
Reviewed-by: Sanika Kulkarni <sanikak@chromium.org>
1 file changed