Skip to content

Commit 71f2e7b

Browse files
committed
fix(ADBDriver): supress output
1 parent 8786e31 commit 71f2e7b

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

labgrid/driver/adb.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,13 @@ def __attrs_post_init__(self):
4646
subprocess.run(
4747
[self.tool, "disconnect", f"{self._host}:{str(self._port)}"],
4848
stderr=subprocess.DEVNULL,
49+
stdout=subprocess.DEVNULL,
4950
timeout=ADB_TIMEOUT,
5051
check=False,
5152
)
5253
subprocess.run(
5354
[self.tool, "connect", f"{self._host}:{str(self._port)}"],
55+
stderr=subprocess.DEVNULL,
5456
stdout=subprocess.DEVNULL,
5557
timeout=ADB_TIMEOUT,
5658
check=True,
@@ -63,6 +65,7 @@ def on_deactivate(self):
6365
subprocess.run(
6466
[self.tool, "disconnect", f"{self._host}:{str(self._port)}"],
6567
stderr=subprocess.DEVNULL,
68+
stdout=subprocess.DEVNULL,
6669
timeout=ADB_TIMEOUT,
6770
check=True,
6871
)
@@ -74,7 +77,8 @@ def _run(self, cmd, *, timeout=30.0, codec="utf-8", decodeerrors="strict"):
7477
result = subprocess.run(
7578
cmd,
7679
text=True, # Automatically decode using default UTF-8
77-
capture_output=True,
80+
stderr=subprocess.DEVNULL,
81+
stdout=subprocess.DEVNULL,
7882
timeout=timeout,
7983
)
8084
return (
@@ -97,12 +101,12 @@ def get_status(self):
97101
@Driver.check_active
98102
@step(args=["filename", "remotepath", "timeout"])
99103
def put(self, filename: str, remotepath: str, timeout: float = ADB_TIMEOUT):
100-
subprocess.run([*self._base_command, "push", filename, remotepath], timeout=timeout, check=True)
104+
subprocess.run([*self._base_command, "push", filename, remotepath], timeout=timeout, check=True, stderr=subprocess.DEVNULL, stdout=subprocess.DEVNULL,)
101105

102106
@Driver.check_active
103107
@step(args=["filename", "destination", "timeout"])
104108
def get(self, filename: str, destination: str, timeout: float = ADB_TIMEOUT):
105-
subprocess.run([*self._base_command, "pull", filename, destination], timeout=timeout, check=True)
109+
subprocess.run([*self._base_command, "pull", filename, destination], timeout=timeout, check=True, stderr=subprocess.DEVNULL, stdout=subprocess.DEVNULL,)
106110

107111
# Reset Protocol
108112

@@ -117,4 +121,4 @@ def reset(self, mode=None):
117121
raise ValueError(f"{mode} must be one of: {', '.join(valid_modes)}")
118122
cmd.append(mode)
119123

120-
subprocess.run(cmd, timeout=ADB_TIMEOUT, check=True)
124+
subprocess.run(cmd, timeout=ADB_TIMEOUT, check=True, stderr=subprocess.DEVNULL, stdout=subprocess.DEVNULL,)

0 commit comments

Comments
 (0)