diff options
author | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2018-11-09 11:25:44 +0000 |
---|---|---|
committer | Daniel Silverstone <daniel.silverstone@codethink.co.uk> | 2018-11-09 11:25:44 +0000 |
commit | 7738f6df9c1a92f1fb32eb49604bc4b2357b5b12 (patch) | |
tree | e2819978f028c0908e3ada5a0f4cf3c967650875 | |
parent | d153453cf927042e33bdb756407cda3977e66707 (diff) | |
download | buildstream-danielsilverstone-ct/plugin-destroy-debug-to-stderr.tar.gz |
plugin.py: Redirect DEBUG from `__del__` to `sys.stderr`danielsilverstone-ct/plugin-destroy-debug-to-stderr
Previously, debug messages from `Plugin.__del__()` went to stdout
which was a problem for the test suite in extremely rare and hard to
predict circumstances. This corrects that by sending the message to
stderr where all the rest of the messages tend to go.
Signed-off-by: Daniel Silverstone <daniel.silverstone@codethink.co.uk>
-rw-r--r-- | buildstream/plugin.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/buildstream/plugin.py b/buildstream/plugin.py index 1b021d4b4..00e0ed795 100644 --- a/buildstream/plugin.py +++ b/buildstream/plugin.py @@ -111,6 +111,7 @@ Class Reference import os import subprocess +import sys from contextlib import contextmanager from weakref import WeakValueDictionary @@ -190,7 +191,7 @@ class Plugin(): # Dont send anything through the Message() pipeline at destruction time, # any subsequent lookup of plugin by unique id would raise KeyError. if self.__context.log_debug: - print("DEBUG: Destroyed: {}".format(self)) + sys.stderr.write("DEBUG: Destroyed: {}\n".format(self)) def __str__(self): return "{kind} {typetag} at {provenance}".format( |