• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright 2022 The Chromium Authors
2# Use of this source code is governed by a BSD-style license that can be
3# found in the LICENSE file.
4"""Defines erminctl interface compatible with modern scripts."""
5
6import subprocess
7from typing import List
8
9from compatible_utils import get_ssh_prefix
10from common import get_ssh_address
11import base_ermine_ctl
12
13
14class ErmineCtl(base_ermine_ctl.BaseErmineCtl):
15    """ErmineCtl adaptation for modern scripts."""
16
17    def __init__(self, target_id: str):
18        super().__init__()
19        self._ssh_prefix = get_ssh_prefix(get_ssh_address(target_id))
20
21    def execute_command_async(self, args: List[str]) -> subprocess.Popen:
22        return subprocess.Popen(self._ssh_prefix + args,
23                                stdout=subprocess.PIPE,
24                                stderr=subprocess.STDOUT,
25                                encoding='utf-8')
26