From 7738f6df9c1a92f1fb32eb49604bc4b2357b5b12 Mon Sep 17 00:00:00 2001 From: Daniel Silverstone Date: Fri, 9 Nov 2018 11:25:44 +0000 Subject: plugin.py: Redirect DEBUG from `__del__` to `sys.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 --- buildstream/plugin.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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( -- cgit v1.2.1