@@ -405,7 +405,7 @@ export default class WorkspacesForeachCommand extends BaseCommand {
405
405
needsProcessing . delete ( identHash ) ;
406
406
processing . delete ( workspace . anchoredDescriptor . descriptorHash ) ;
407
407
408
- return exitCode ;
408
+ return { workspace , exitCode} ;
409
409
} ) ) ;
410
410
411
411
// If we're not executing processes in parallel we can just wait for it
@@ -424,13 +424,15 @@ export default class WorkspacesForeachCommand extends BaseCommand {
424
424
return ;
425
425
}
426
426
427
- const exitCodes : Array < number > = await Promise . all ( commandPromises ) ;
428
- const errorCode = exitCodes . find ( code => code !== 0 ) ;
427
+ const results : Array < { workspace : Workspace , exitCode : number } > = await Promise . all ( commandPromises ) ;
428
+ results . forEach ( ( { workspace, exitCode} ) => {
429
+ if ( exitCode !== 0 ) {
430
+ report . reportError ( MessageName . UNNAMED , `The command failed in workspace ${ structUtils . prettyLocator ( configuration , workspace . anchoredLocator ) } ` ) ;
431
+ }
432
+ } ) ;
429
433
430
- // The order in which the exit codes will be processed is fairly
431
- // opaque, so better just return a generic "1" for determinism.
432
- if ( finalExitCode === null )
433
- finalExitCode = typeof errorCode !== `undefined` ? 1 : finalExitCode ;
434
+ const exitCodes = results . map ( result => result . exitCode ) ;
435
+ const errorCode = exitCodes . find ( code => code !== 0 ) ;
434
436
435
437
if ( ( this . topological || this . topologicalDev ) && typeof errorCode !== `undefined` ) {
436
438
report . reportError ( MessageName . UNNAMED , `The command failed for workspaces that are depended upon by other workspaces; can't satisfy the dependency graph` ) ;
0 commit comments