From 950c4bafc1b558a07cdb4bc26641923fce7ef871 Mon Sep 17 00:00:00 2001 From: Tomas Kopecek Date: Nov 20 2018 20:54:47 +0000 Subject: use stderr for warning Fixes: https://pagure.io/koji/issue/1047 --- diff --git a/cli/koji_cli/commands.py b/cli/koji_cli/commands.py index 8f83191..c9d4ac5 100644 --- a/cli/koji_cli/commands.py +++ b/cli/koji_cli/commands.py @@ -40,7 +40,7 @@ from koji_cli.lib import _, OptionParser, activate_session, parse_arches, \ _unique_path, _running_in_bg, _progress_callback, watch_tasks, \ arg_filter, linked_upload, list_task_output_all_volumes, \ print_task_headers, print_task_recurse, download_file, watch_logs, \ - error, greetings, _list_tasks, unique_path + error, warn, greetings, _list_tasks, unique_path def _printable_unicode(s): @@ -3088,7 +3088,7 @@ def anon_handle_buildinfo(goptions, session, args): build = int(build) info = session.getBuild(build) if info is None: - print("No such build: %s\n" % build) + warn("No such build: %s\n" % build) continue task = None if info['task_id']: @@ -6701,14 +6701,14 @@ def anon_handle_download_logs(options, session, args): write_fail_log(task_log_dir, task_id) count += 1 elif state not in ['CLOSED', 'CANCELED']: - sys.stderr.write(_("Warning: task %s is %s\n") % (task_id, state)) + warn(_("Warning: task %s is %s\n") % (task_id, state)) for log_filename, log_volume in logs: download_log(task_log_dir, task_id, log_filename, volume=log_volume) count += 1 if count == 0 and not recurse: - sys.stderr.write(_("No logs found for task %i. Perhaps try --recurse?\n") % task_id) + warn(_("No logs found for task %i. Perhaps try --recurse?\n") % task_id) if recurse: child_tasks = session.getTaskChildren(task_id)