[Bug 5660] New: hg should not put warning messages in stdout

mercurial-bugs at mercurial-scm.org mercurial-bugs at mercurial-scm.org
Tue Aug 15 11:26:06 UTC 2017


https://bz.mercurial-scm.org/show_bug.cgi?id=5660

            Bug ID: 5660
           Summary: hg should not put warning messages in stdout
           Product: Mercurial
           Version: unspecified
          Hardware: PC
                OS: Linux
            Status: UNCONFIRMED
          Severity: bug
          Priority: wish
         Component: Mercurial
          Assignee: bugzilla at mercurial-scm.org
          Reporter: aalekseyev at janestreet.com
                CC: mercurial-devel at mercurial-scm.org

This is basically a duplicate of
https://bz.mercurial-scm.org/show_bug.cgi?id=2828, but I think the resolution
of that is insufficient.

Currently hg prints various diagnostic/warning messages to stdout even for
commands that produce machine-readable output. For example:

$ hg id 'ssh://irrelevant' -e 'echo ssh diagnostic message >&2; true'
2>/dev/null
remote: ssh diagnostic message
EXIT STATUS 255

These messages get printed to stdout even in the case of success, which means
that it's almost impossible to use [hg] in programs that require the output to
be in the correct format. If you're lucky these warning messages won't parse,
and if you're unlucky you might end up interpreting them as something
meaningful.

Examples of such messages that actually cause issues include:

- waiting for lock ...
- got lock after ...
- warning messages from ssh:
-- remote: X11 forwarding request failed on channel ...
-- remote: ControlSocket ... already exists, disabling multiplexing

[--quiet] was proposed as a workaround, and I think it's great when the [hg]
command ends up succeeding. The problem is that if the command fails you can
end up with a much less informative error message. E.g. this command doesn't
show why ssh failed:

$ hg id 'ssh://irrelevant' --quiet -e 'echo ssh diagnostic message >&2; false'
2>/dev/null
EXIT STATUS 255

-- 
You are receiving this mail because:
You are on the CC list for the bug.


More information about the Mercurial-devel mailing list