Skip to content

Commit 958e54e

Browse files
committed
feat(@angular/cli): add flags to the process title
Closes #8772 Fixes #6888 Special thanks to @tomastrajan for original PR.
1 parent ec3fa80 commit 958e54e

File tree

2 files changed

+23
-1
lines changed
  • packages/angular/cli/bin
  • tests/legacy-cli/e2e/tests/misc

2 files changed

+23
-1
lines changed

packages/angular/cli/bin/ng

+7-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,14 @@
33

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

13+
// Some older versions of Node do not support let or const.
814
var version = process.version.substr(1).split('.');
915
if (Number(version[0]) < 8 || (Number(version[0]) === 8 && Number(version[1]) < 9)) {
1016
process.stderr.write(
+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import {exec, execAndWaitForOutputToMatch, killAllProcesses} from '../../utils/process';
2+
3+
4+
export default async function() {
5+
try {
6+
await execAndWaitForOutputToMatch('ng', ['build', '--watch'], /./);
7+
8+
const output = await exec('ps');
9+
10+
if (!output.stdout.match(/ng build --watch/)) {
11+
throw new Error('Title of the process was not properly set.');
12+
}
13+
} finally {
14+
await killAllProcesses();
15+
}
16+
}

0 commit comments

Comments
 (0)