diff --git a/cvs/cli_plugins/base.py b/cvs/cli_plugins/base.py index fafe1ad17..7bd32f01c 100644 --- a/cvs/cli_plugins/base.py +++ b/cvs/cli_plugins/base.py @@ -1,3 +1,6 @@ +import sys + + class SubcommandPlugin: """Base class for CLI subcommand plugins.""" @@ -6,6 +9,10 @@ class SubcommandPlugin: "exec": 1000, # High number to ensure exec appears last } + def _emit_error(self, msg, json_mode): + """Print an error message. In JSON mode, writes to stderr so stdout stays valid JSON.""" + print(msg, file=sys.stderr if json_mode else sys.stdout) + def get_name(self): raise NotImplementedError diff --git a/cvs/cli_plugins/exec_plugin.py b/cvs/cli_plugins/exec_plugin.py index b1ac79fcb..226aeb133 100644 --- a/cvs/cli_plugins/exec_plugin.py +++ b/cvs/cli_plugins/exec_plugin.py @@ -160,10 +160,6 @@ def _run_on_hosts( return True, output - def _emit_error(self, msg, json_mode): - """Print an error message. In JSON mode, writes to stderr so stdout stays valid JSON.""" - print(msg, file=sys.stderr if json_mode else sys.stdout) - def _print_text_output(self, label, host_output): """Print host results in human-readable format.""" for host, out in host_output.items():