Skip to content

ng overwrites/hides Windows Command Prompt title #19205

@wqoq

Description

@wqoq

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

No. As far as I can tell this would have been an issue for as long as Angular CLI has been using process.title = 'something';.

Description

Node's process.title overwrites the entire window title in Windows Command Prompt, which is non-standard behaviour, and makes it very difficult to identify similar windows.

Standard Windows Command Prompt behaviour is to show "{title} - {command}", and this works perfectly if I comment out or remove any reference to process.title, for instance in packages/angular/cli/bin/ng:

// Provide a title to the process in `ps`.
// Due to an obscure Mac bug, do not start this title with any symbol.
try {
  process.title = 'ng ' + Array.from(process.argv).slice(2).join(' ');
} catch (_) {
  // If an error happened above, use the most basic title.
  process.title = 'ng';
}

🔬 Minimal Reproduction

  1. Open a Windows Command Prompt using cmd.exe.
  2. Set the title of the window using the title command (e.g. title My Angular App).
  3. Run any ng command (ng version, ng build --watch, etc...)
  4. While ng is running, the title of the window is completely replaced by whatever ng command was run.

Technically, step 2 is not required to exhibit this bug. I mention it merely to demonstrate why I'm using it (as mentioned in the "Anything else" section below). It happens even with the default title when the window opens.

🌍 Your Environment

From systeminfo:

OS Name:                   Microsoft Windows 10 Enterprise
OS Version:                10.0.18363 N/A Build 18363

From ng version:

Angular CLI: 9.1.1
Node: 13.3.0
OS: win32 x64

Angular: 9.1.1
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, localize, platform-browser
... platform-browser-dynamic, router
Ivy Workspace: Yes

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.901.1
@angular-devkit/build-angular      0.901.1
@angular-devkit/build-ng-packagr   0.901.1
@angular-devkit/build-optimizer    0.901.1
@angular-devkit/build-webpack      0.901.1
@angular-devkit/core               9.1.1
@angular-devkit/schematics         9.1.1
@angular/cdk                       9.2.0
@angular/flex-layout               9.0.0-beta.29
@angular/material                  9.2.0
@angular/material-moment-adapter   9.2.0
@ngtools/webpack                   9.1.1
@schematics/angular                9.1.1
@schematics/update                 0.901.1
ng-packagr                         9.0.0
rxjs                               6.5.4
typescript                         3.7.5
webpack                            4.42.0

Anything else relevant?
I assume this only affects Windows. The current behaviour is extremely frustrating because I run multiple apps at the same time, each in a separate window, which I've named "Custom App 1", "Custom App 2", etc..., but once they all start running, each window is identically named "ng build --watch". It's really hard to observe them when I don't know which one is which.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions