Skip to content

Commit 70232e4

Browse files
authored
Merge pull request #1395 from threexc/tgamblin/ser2net_check
exporter: check ser2net version in exporter
2 parents acb438d + f7a1d38 commit 70232e4

1 file changed

Lines changed: 10 additions & 1 deletion

File tree

labgrid/remote/exporter.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,8 +225,17 @@ def _start(self, start_params):
225225
self.port = get_free_port()
226226

227227
# Ser2net has switched to using YAML format at version 4.0.0.
228-
_, _, version = str(subprocess.check_output([self.ser2net_bin,'-v'])).split(' ')
228+
result = subprocess.run([self.ser2net_bin,'-v'], capture_output=True, text=True)
229+
_, _, version = str(result.stdout).split(' ')
229230
major_version = version.split('.')[0]
231+
232+
# There is a bug in ser2net between 4.4.0 and 4.6.1 where it
233+
# returns 1 on a successful call to 'ser2net -v'. We don't want
234+
# a failure because of this, so raise an error only if ser2net
235+
# is not one of those versions.
236+
if version.strip() not in ["4.4.0", "4.5.0", "4.5.1", "4.6.0", "4.6.1"] and result.returncode == 1:
237+
raise ExporterError(f"ser2net {version} returned a nonzero code during version check.")
238+
230239
if int(major_version) >= 4:
231240
cmd = [
232241
self.ser2net_bin,

0 commit comments

Comments
 (0)