autotest: compress sysinfo inflight

Devices with small tmpfs-based /tmp mounts may not have enough
space for uncompressed sysinfo files, so this change pipes the
files through gzip rather than gzipping after writing.

BUG=b:129220988
TEST=Ran tests on Gale in Jetstream lab, verified compression.

Change-Id: I7133418adddf56b4cf76e25b77640b08c7de2c40
Reviewed-on: https://chromium-review.googlesource.com/1592639
Commit-Ready: Laurence Goodby <lgoodby@chromium.org>
Tested-by: Laurence Goodby <lgoodby@chromium.org>
Reviewed-by: Chris Morin <cmtm@chromium.org>
(cherry picked from commit 564d2f818f2b5dda2d61903baa9de28583befe84)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/autotest/+/1594982
Commit-Queue: Laurence Goodby <lgoodby@chromium.org>
diff --git a/client/bin/base_sysinfo.py b/client/bin/base_sysinfo.py
index 261f9b0..f8d87dc 100644
--- a/client/bin/base_sysinfo.py
+++ b/client/bin/base_sysinfo.py
@@ -131,7 +131,9 @@
             logf = cmd.replace(" ", "_")
         super(command, self).__init__(logf, log_in_keyval)
         self.cmd = cmd
-        self._compress_log = compress_log
+        if compress_log:
+            self.cmd += ' | gzip -9'
+            self.logf += '.gz'
 
 
     def __repr__(self):
@@ -182,8 +184,6 @@
         finally:
             for f in (stdin, stdout, stderr):
                 f.close()
-            if self._compress_log and os.path.exists(logf_path):
-                utils.system('gzip -9 "%s"' % logf_path, ignore_status=True)
 
 
 class base_sysinfo(object):