Skip to content

Messages about overriding content and/or version URLs on STDOUT spoil JSON output #1620

Open
@bwarden

Description

@bwarden

If we override the content or version URLs using -u, -c, or -v, we print out a message on STDOUT warning about it:

case 'u':
print("Overriding version and content URLs with %s\n", optarg);
set_version_url(optarg);
set_content_url(optarg);
return true;
case 'P':
err = str_to_int(optarg, &globals.update_server_port);
if (err < 0 || globals.update_server_port < 0) {
error("Invalid --port argument: %s\n\n", optarg);
return false;
}
return true;
case 'c':
print("Overriding content URL with %s\n", optarg);
set_content_url(optarg);
return true;
case 'v':
print("Overriding version URL with %s\n", optarg);
set_version_url(optarg);
return true;

In most cases, this is probably fine. But if we've been given -j for JSON output, we really should only be outputting valid JSON strings. We should probably move these (and any other) warnings to STDERR.

This will likely affect test cases, too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions