plugins/python/example_io_plugin.py: fix backtrace during destructor
If the plugin fails to open the file for writing, constructor will raise an exception and exit before creating the "_log" member variable. So the destructor will also raise a backtrace. (Which python ignores, but dumps out to stderr.)
This commit is contained in:

committed by
Todd C. Miller

parent
5be81eb25b
commit
591d57ad28
@@ -61,6 +61,7 @@ class SudoIOPlugin(sudo.Plugin):
|
||||
self._log("", "-- Plugin STARTED --")
|
||||
|
||||
def __del__(self):
|
||||
if hasattr(self, "_log_file"):
|
||||
self._log("", "-- Plugin DESTROYED --")
|
||||
|
||||
def open(self, argv: Tuple[str, ...], command_info: Tuple[str, ...]) -> int:
|
||||
|
Reference in New Issue
Block a user