Good ways to view Firefox compile errors in a terminal?

Nicholas Nethercote n.nethercote at gmail.com
Mon Jan 12 14:09:42 PST 2015


Hi,

If you do |mach build| and get compile errors, often those errors
scroll quickly off screen and they are mixed in with other lines of
output and it's hard to find them.

I deal with this by using a bash alias that calls |mach build| and
pipes the output to file. I can then use Vim's quicklists feature to
jump directly to errors in the file. But sometimes I just want to
eyeball the errors directly in the terminal, so in my alias I also
have a post-build step that greps the output file for the first five
error messages.

This setup works well for me but it's also kinda gross [1] and this
seems like a problem that everybody else working on C++ code has to
deal with as well. So I'm wondering if there are other, better ways of
doing it, and if so, could they be made automatic? There is |mach
warnings-list| which is sort of like this, but not quite.

Thanks.

Nick

[1] How gross? Here are the two most important lines:

    # Send mach's raw output to stdout and $config/log, and the
    # timestamp-stripped output to errors.err. The "$| = 1" disables Perl's
    # buffering, so the output is available immediately.
    MOZCONFIG=$HOME/moz/config/$config nice mach build $restdir 2>&1 | \
        tee >(perl -p -e '$| = 1; s/^ *\d+:\d\d\.\d\d //' > errors.err) \
            $config/log

    # Show up to five errors, with 10 lines of trailing context each.  But
    # first, truncate line length to 300 chars (because I sometimes get
    # extremely long lines describing the command line used, which are
    # annoying).
    perl -p -e 's/^(.{300}).*$/\1/' $config/log | \
        grep --max-count=5 --before-context=3 --after-context=10 "\<error:"


More information about the dev-platform mailing list