diff --git a/plugins/python/example_io_plugin.py b/plugins/python/example_io_plugin.py index cfe908900..6c44c39ed 100644 --- a/plugins/python/example_io_plugin.py +++ b/plugins/python/example_io_plugin.py @@ -63,6 +63,7 @@ class SudoIOPlugin(sudo.Plugin): def __del__(self): if hasattr(self, "_log_file"): self._log("", "-- Plugin DESTROYED --") + self._log_file.close() def open(self, argv: Tuple[str, ...], command_info: Tuple[str, ...]) -> int: """Receives the command the user wishes to run. diff --git a/plugins/python/regress/testdata/check_example_io_plugin_fails_with_python_backtrace.stdout b/plugins/python/regress/testdata/check_example_io_plugin_fails_with_python_backtrace.stdout index 3177aa975..4bdfc6a7a 100644 --- a/plugins/python/regress/testdata/check_example_io_plugin_fails_with_python_backtrace.stdout +++ b/plugins/python/regress/testdata/check_example_io_plugin_fails_with_python_backtrace.stdout @@ -2,6 +2,6 @@ Example sudo python plugin will log to /some/not/writable/directory/sudo.log Traceback: File "SRC_DIR/example_io_plugin.py", line 60, in __init__ self._open_log_file(path.join(log_path, "sudo.log")) - File "SRC_DIR/example_io_plugin.py", line 131, in _open_log_file + File "SRC_DIR/example_io_plugin.py", line 132, in _open_log_file self._log_file = open(log_path, "a")