detect TeamCity
See original GitHub issueit would be good to disable coloring if process runes from TeamCity. Here is node -p 'process.env'
output from TeamCity build step:
{ TEAMCITY_BUILD_PROPERTIES_FILE: ‘/opt/teamcity/buildagetnt/temp/buildTmp/teamcity.build2602458914988989541.properties’, TERM: ‘linux’, JRE_17_x64: ‘/usr/lib/jvm/jre’, TMPDIR: ‘/opt/teamcity/buildagetnt/temp/buildTmp’, TEAMCITY_CAPTURE_ENV: ‘“/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.85.x86_64/jre/bin/java” -jar “/opt/teamcity/buildagetnt/plugins/environment-fetcher/bin/env-fetcher.jar”’, TEAMCITY_VERSION: ‘9.0.5 (build 32523)’, JRE_HOME: ‘/usr/bin/…’, TEMP: ‘/opt/teamcity/buildagetnt/temp/buildTmp’, TEAMCITY_BUILDCONF_NAME: ‘api api’, BUILD_VCS_NUMBER: ‘95fb89fd9d28’, NLSPATH: ‘/usr/dt/lib/nls/msg/%L/%N.cat’, PATH: ‘/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/bin:/usr/local/lib’, RUNLEVEL: ‘3’, runlevel: ‘3’, _: ‘/usr/bin/node’, PWD: ‘/opt/teamcity/buildagetnt/work/abeaf100e9e82338’, LANGSH_SOURCED: ‘1’, DOCKER_CONFIG: ‘/usr/local/etc/.docker’, TEAMCITY_GIT_PATH: ‘/usr/bin/git’, LANG: ‘en_US.UTF-8’, PREVLEVEL: ‘N’, previous: ‘N’, XFILESEARCHPATH: ‘/usr/dt/app-defaults/%L/Dt’, CONSOLETYPE: ‘serial’, BUILD_VCS_NUMBER_feedbackforum_feedbackforumapi: ‘95fb89fd9d28’, HOME: ‘/root/’, SHLVL: ‘4’, TEAMCITY_PROCESS_FLOW_ID: ‘818047604373’, UPSTART_INSTANCE: ‘’, TMP: ‘/opt/teamcity/buildagetnt/temp/buildTmp’, UPSTART_EVENTS: ‘runlevel’, BUILD_NUMBER: ‘150’, JRE_17: ‘/usr/lib/jvm/jre’, UPSTART_JOB: ‘rc’, TEAMCITY_PROJECT_NAME: ‘10 tests’, COMPOSER_HOME: ‘/usr/local/bin’, TEAMCITY_PROCESS_PARENT_FLOW_ID: ‘’ }
In similar situation xUnit runner uses TEAMCITY_PROJECT_NAME env variable to detect that it running from TeamCity
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (7 by maintainers)
Top GitHub Comments
@Qix- It’s a CI. I don’t see why we can’t handle situations like this gracefully.
@Qix- In a perfect world, yes. I used to think that way too, but in reality they never do and you always just end up having to implement workarounds in every module…
This should cover most of them though: https://github.com/chalk/supports-color/commit/9170da93dde30a88040b388176628b482bf64515