Skip to content

Commit e192e8c

Browse files
committed
fix(@angular/cli): set process title when running architect commands
When running an Architect command for a specific project, the process title is now updated to include the project's name. This provides better visibility in process lists, making it easier to identify which project is being built or served, especially in multi-project workspaces. The original process title is restored after the command finishes execution. Closes #31110
1 parent 9b7ab11 commit e192e8c

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

packages/angular/cli/src/command-builder/architect-command-module.ts

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,11 +97,17 @@ export abstract class ArchitectCommandModule
9797
}
9898

9999
async run(options: Options<ArchitectCommandArgs> & OtherOptions): Promise<number | void> {
100-
const target = this.getArchitectTarget();
100+
const originalProcessTitle = process.title;
101+
try {
102+
const target = this.getArchitectTarget();
103+
const { configuration = '', project, ...architectOptions } = options;
101104

102-
const { configuration = '', project, ...architectOptions } = options;
105+
if (project) {
106+
process.title = `${originalProcessTitle} (${project})`;
107+
108+
return await this.runSingleTarget({ configuration, target, project }, architectOptions);
109+
}
103110

104-
if (!project) {
105111
// This runs each target sequentially.
106112
// Running them in parallel would jumble the log messages.
107113
let result = 0;
@@ -111,12 +117,13 @@ export abstract class ArchitectCommandModule
111117
}
112118

113119
for (const project of projectNames) {
120+
process.title = `${originalProcessTitle} (${project})`;
114121
result |= await this.runSingleTarget({ configuration, target, project }, architectOptions);
115122
}
116123

117124
return result;
118-
} else {
119-
return await this.runSingleTarget({ configuration, target, project }, architectOptions);
125+
} finally {
126+
process.title = originalProcessTitle;
120127
}
121128
}
122129

0 commit comments

Comments
 (0)