mirror of
https://github.com/PX4/PX4-Autopilot.git
synced 2026-05-21 21:55:34 +08:00
mavsdk_tests: prevent exception if log_fd is None
This commit is contained in:
@@ -134,7 +134,7 @@ class Tester:
|
||||
self.gui = gui
|
||||
self.verbose = verbose
|
||||
self.start_time = datetime.datetime.now()
|
||||
self.combined_log_fd = TextIO
|
||||
self.log_fd: Any[TextIO] = None
|
||||
|
||||
@classmethod
|
||||
def determine_tests(cls,
|
||||
@@ -456,7 +456,8 @@ class Tester:
|
||||
self.log_fd = open(filename, 'w')
|
||||
|
||||
def stop_combined_log(self) -> None:
|
||||
self.log_fd.close()
|
||||
if self.log_fd:
|
||||
self.log_fd.close()
|
||||
|
||||
def add_to_combined_log(self, output: str) -> None:
|
||||
self.log_fd.write(output)
|
||||
|
||||
Reference in New Issue
Block a user