Skip to content

Don't print progress in a non-TTY context #8148

Description

@mgol

Bug Report or Feature Request (mark with an x)

- [ ] bug report -> please search issues before submitting
- [x] feature request

Versions.

@angular/cli: 1.4.5
node: 8.7.0
os: darwin x64
@angular/common: 4.4.4
@angular/compiler: 4.4.4
@angular/core: 4.4.4
@angular/forms: 4.4.4
@angular/http: 4.4.4
@angular/platform-browser: 4.4.4
@angular/platform-browser-dynamic: 4.4.4
@angular/router: 4.4.4
@angular/cli: 1.4.5
@angular/compiler-cli: 4.4.4
typescript: 2.3.4

Repro steps.

Run ng build --prod --aot in a CI environment like Travis CI or GitLab CI. You'll see something like:

0% compiling 10% building modules 0/1 modules 1 active project/src/main.ts 10% building modules 1/1 modules 0 active 10% building modules 1/2 modules 1 active project/src/polyfills.ts 10% building modules 2/2 modules 0 active 10% building modules 2/3 modules 1 active project/src/styles.scss 10% building modules 3/3 modules 0 active 10% building modules 3/4 modules 1 active project/src/styles.scss 10% building modules 4/4 modules 0 active 10% building modules 4/5 modules 1 active ...de_modules/css-loader/lib/css-base.js 10% building modules 5/5 modules 0 active 10% building modules 5/6 modules 1 active project/src/main.ts 10% building modules 5/7 modules 2 active project/src/polyfills.ts 10% building modules 6/7 modules 1 active project/src/polyfills.ts 10% building modules 7/7 modules 0 active 10% building modules 7/8 modules 1 active project/src/environments/environment.ts 10% building modules 8/8 modules 0 active 10% building modules 8/9 modules 1 active ...$$_gendir/app/app.module.ngfactory.ts 11% building modules 9/9 modules 0 active 11% building modules 9/10 modules 1 active project/src/app/app.module.ts 11% building modules 10/10 modules 0 active 11% building modules 10/11 modules 1 active project/src/app/app.component.ts 11% building modules 11/11 modules 0 active 11% building modules 11/12 modules 1 active ...gendir/app/app.component.ngfactory.ts

This can be alleviated by passing the --no-progress flag to ng build but it introduces a mental burden to add that to every command invoked on CI. If you have many such commands or if they're deeply nested in npm scripts this may require duplicating a lot of code.

The log given by the failure.

N/A

Desired functionality.

Angular CLI should not print progress when run in a non-TTY environment. Optionally it could switch its reporter to something like dots that only appends a dot when something happens and doesn't try to rewrite the output, printing a lot of noise.

Mention any other details that might be useful.

Node.js has an API for this exact purpose: process.stdout.isTTY, see https://nodejs.org/api/tty.html

Activity

  1. added
    help wanted
    P3
    feature
    on Oct 25, 2017
  2. filipesilva commented on Oct 25, 2017

    @filipesilva
    Contributor

    I agree that we should use the API to determine the system default. Would be really helpful.

  3. added a commit that references this issue on Oct 26, 2017
    c416e90
  4. added 2 commits that reference this issue on Nov 15, 2017
    2681fde
    428835e
  5. added a commit that references this issue on Nov 21, 2017
    4774049
  6. mgol commented on Dec 14, 2017

    @mgol
    MemberAuthor

    Something still doesn't work here. In Karma tests run via WebStorm process.stdout.isTTY === undefined (I checked) and yet the progress is printed, flooding the console. The same happens to me in GitLab CI. Angular CLI 1.6.0.

  7. devoto13 commented on Dec 14, 2017

    @devoto13
    Contributor

    @mgol I don't use GitLab CI, so don't know why it does not work there.

    Regarding WebStorm: my PR only changes the default for the --progress flag of the ng test command. So if you use Karma run configuration in WebStorm it will still print progress, because WebStorm runs Karma directly and not using ng test command. I think we should also update here - change from true to process.stdout.isTTY === true, so this feature will also work when running Karma directly. Can you submit a PR?

  8. mgol commented on Dec 14, 2017

    @mgol
    MemberAuthor

    @devoto13 OK, thanks, I know what's happening now.

    In GitLab CI process.stdout.isTTY === undefined as well, the progress I'm seeing comes from building the universal app according to the Universal CLI story i.e. via:

    webpack --config webpack.server.config.js --progress --colors
    

    That's a Webpack thing, not CLI one, though so here what's needed is mostly the Karma modification. I'll see what I can do.

  9. added 2 commits that reference this issue on Dec 18, 2017
    8249573
    d3b1f7f
  10. added 2 commits that reference this issue on Dec 19, 2017
    e87209c
    7587a02
  11. added 2 commits that reference this issue on Apr 23, 2018
    150589a
    b47af50
  12. mgol commented on Jun 11, 2018

    @mgol
    MemberAuthor

    This has regressed in CLI 6, see a new bug report: #11195.

  13. angular-automatic-lock-bot commented on Sep 8, 2019

    @angular-automatic-lock-bot

    This issue has been automatically locked due to inactivity.
    Please file a new issue if you are encountering a similar or related problem.

    Read more about our automatic conversation locking policy.

    This action has been performed automatically by a bot.

  14. locked and limited conversation to collaborators on Sep 8, 2019
  15. added 2 commits that reference this issue on May 29, 2026
    7e2cf22
    5a1d800
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P3effort1: easy (hours)featurehelp wanted

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions