Closed Bug 1347290 Opened 4 years ago Closed 3 years ago

When running mach from eshell, each line ends with `None`

Categories

(Firefox Build System :: Mach Core, enhancement)

enhancement
Not set
normal

Tracking

(firefox55 fixed)

RESOLVED FIXED
mozilla55
Tracking Status
firefox55 --- fixed

People

(Reporter: nika, Assigned: nika)

Details

Attachments

(1 file)

When sshing into my desktop, I often run mach from within eshell. Recently some change caused every line printed by mach during commands like `mach build` to end with the text `None`, for example:

 0:16.97 force-cargo-library-buildNone
 0:17.79 force-cargo-library-buildNone
 0:18.21     Blocking waiting for file lock on build directoryNone
 0:18.27     Finished release [optimized + debuginfo] target(s) in 0.3 secsNone
 0:18.40     Finished release [optimized + debuginfo] target(s) in 0.0 secsNone
 0:18.88 firefoxNone
 0:21.89 libtoolkit_components_printingui_ipc.a.descNone
 0:21.95 libxul_s.a.descNone
 0:21.95 libxul.soNone

I imagine this is due to trying to print something like an ANSI color code at the end of the line, and the lookup failing when looking at eshell's TERM variable (which is 'dumb').
I did some looking. The problem is here:
http://searchfox.org/mozilla-central/rev/b8cce081200129a1307e2a682f121135b5ca1d19/python/mach/mach/logging.py#96
Namely it seems like self._sgr0 is set to None, as both `terminal` and
`blessings` are truthy, but blessings.tigetstr('sgr0') returns None.

This is a super simple patch which should change that behaviour.

MozReview-Commit-ID: vP4izM2RwP
Attachment #8855497 - Flags: review?(gps)
Assignee: nobody → michael
Comment on attachment 8855497 [details] [diff] [review]
Set sgr0 to '' if blessings.tigetstr('sgr0') returns None

Review of attachment 8855497 [details] [diff] [review]:
-----------------------------------------------------------------

Good catch.
Attachment #8855497 - Flags: review?(gps) → review+
Pushed by gszorc@mozilla.com:
https://hg.mozilla.org/integration/autoland/rev/a238396507d6
Set sgr0 to '' if blessings.tigetstr('sgr0') returns None, r=gps
https://hg.mozilla.org/mozilla-central/rev/a238396507d6
Status: NEW → RESOLVED
Closed: 3 years ago
Resolution: --- → FIXED
Target Milestone: --- → mozilla55
Product: Core → Firefox Build System
You need to log in before you can comment on or make changes to this bug.