Check if PluginExecutionContext was started before shutting it down.

If a `PluginExecutionContext().shutdown()` is called _before_
`PluginExecutionContext().start()` was called,
this leads to an `AttributeError` exception since finalizer tries to
access to attributes which were never defined.
This commit is contained in:
Vitalii Vokhmin
2017-07-15 15:35:01 +02:00
parent d8b827c1b4
commit 575462ca4c

View File

@ -16,8 +16,9 @@ class PluginExecutionContext(LoopingExecutionContext):
self.wrapped.initialize()
def shutdown(self):
with recoverable(self.handle_error):
self.wrapped.finalize()
if self.started:
with recoverable(self.handle_error):
self.wrapped.finalize()
self.alive = False
def step(self):