gecko-dev/python/mach
Gregory Szorc cc764ee794 Bug 1315785 - Set an environment variable when mach is attached to a TTY; r=glandium
The way it works now, `mach` commands often invoke subprocesses where
the subprocesses' stdio file descriptors are pipes so the mach command
can e.g. parse output.

Processes like clang, gcc, and cargo determine if they can send color
codes to {stderr, stdout} by seeing if those file descriptors are TTYs.
When e.g. `make` is executed via `mach`, this test fails because those
descriptors are pipes (even though they eventually end up on a TTY).

We can't wire the file descriptors to the TTY because `mach` needs
to analyze output. We don't want users defining process flags to force
color in their mozconfigs because color codes would still be sent
if stdout was not a TTY.

This patch sets the MACH_STDOUT_ISATTY environment variable in all mach
commands when stdout is a TTY. Subsequent processes can then look for
this variable to determine whether to override color settings, print
terminal control codes, etc.

MozReview-Commit-ID: GxXP2mQssjC

--HG--
extra : rebase_source : 4b99547b453cb7dd5cb590a71ed554ce2bc4759d
2016-11-08 12:15:13 -08:00
..
docs Bug 1255450 - mach settings documentation fix, DONTBUILD, r=me 2016-04-12 21:03:36 -04:00
mach Bug 1315785 - Set an environment variable when mach is attached to a TTY; r=glandium 2016-11-08 12:15:13 -08:00
README.rst Bug 1108399 - Move mach docs into sphinx; r=ahal 2014-12-07 10:40:19 -08:00
bash-completion.sh
setup.py NO BUG - Bump version of mach to 0.6 2016-05-02 13:36:33 -07:00

README.rst

====
mach
====

Mach (German for *do*) is a generic command dispatcher for the command
line.

To use mach, you install the mach core (a Python package), create an
executable *driver* script (named whatever you want), and write mach
commands. When the *driver* is executed, mach dispatches to the
requested command handler automatically.

To learn more, read the docs in ``docs/``.