factory: Set encoding for `subprocess.Popen`

`subprocess.Popen` uses bytes by default, we will get errors if
we treat it as str type when processing. In python3, we should use str
type as much as possible, so we need to set the encoding or use
`process_utils.Spawn` to get str type.

BUG=chromium:999876
TEST=make test
TEST=manually run code segment in dut python interpreter

Change-Id: Icf617d1d9f2473f6074623ac230c36a702e51d04
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/factory/+/2182095
Commit-Queue: Yilin Yang (kerker) <kerker@chromium.org>
Tested-by: Yilin Yang (kerker) <kerker@chromium.org>
Reviewed-by: Pin-yen Lin <treapking@chromium.org>
diff --git a/py/tools/ovl.py b/py/tools/ovl.py
index 1d6845d..0bef645 100755
--- a/py/tools/ovl.py
+++ b/py/tools/ovl.py
@@ -44,6 +44,8 @@
 from ws4py.client import WebSocketBaseClient
 import yaml
 
+from cros.factory.utils import process_utils
+
 
 _CERT_DIR = os.path.expanduser('~/.config/ovl')
 
@@ -873,14 +875,13 @@
         '%s%s' % (user + '@' if user else '', host)
     ]).wait()
 
-    p = subprocess.Popen([
+    p = process_utils.Spawn([
         'ssh',
         '-S', control_file,
         '-O', 'check', host,
-    ], stderr=subprocess.PIPE)
-    unused_stdout, stderr = p.communicate()
+    ], read_stderr=True, ignore_stdout=True)
 
-    s = re.search(r'pid=(\d+)', stderr)
+    s = re.search(r'pid=(\d+)', p.stderr_data)
     if s:
       return int(s.group(1))