microsoft / rushstack

Monorepo for tools developed by the Rush Stack community
https://rushstack.io/
Other
5.82k stars 592 forks source link

[rush] cobuild errors are not properly propagated. #4831

Closed aramissennyeydd closed 1 month ago

aramissennyeydd commented 1 month ago

Summary

Rush cobuild runBeforeExecute errors are not properly propagated.

Repro steps

Expected result: Marks operations as failed, but gracefully ends the process.

Actual result: Throws with writer already closed message.

Details

Getting an error,

Error: Error: Writer was already closed
    at CollatedWriter.writeChunk (/Users/aramis.sennyey/Projects/rushstack/libraries/terminal/lib/TerminalWritable.js:87:19)
    at CollatedTerminal.writeStderrLine (/Users/aramis.sennyey/Projects/rushstack/libraries/stream-collator/lib/CollatedTerminal.js:23:27)
    at OperationExecutionManager._reportOperationErrorIfAny (/Users/aramis.sennyey/Projects/rushstack/libraries/rush-lib/lib-commonjs/logic/operations/OperationExecutionManager.js:187:44)
    at onOperationCompleteAsync (/Users/aramis.sennyey/Projects/rushstack/libraries/rush-lib/lib-commonjs/logic/operations/OperationExecutionManager.js:147:22)
    at async OperationExecutionRecord.executeAsync (/Users/aramis.sennyey/Projects/rushstack/libraries/rush-lib/lib-commonjs/logic/operations/OperationExecutionRecord.js:239:13)
    at async node_core_library_1.Async.forEachAsync.concurrency (/Users/aramis.sennyey/Projects/rushstack/libraries/rush-lib/lib-commonjs/logic/operations/OperationExecutionManager.js:158:13)
rush cobuild - Errors! (6.86 seconds)

which hides the real error,

Error: Failed to get completed_state(cobuild:completed:foo:2ff666388f6e7919036f5c12279839a3c190d8b0)_package(e)_phase(_phase:build): Disconnects client

and ends the process.

Standard questions

Please answer these questions to help us investigate your issue more quickly:

Question Answer
@microsoft/rush globally installed version? 5.128.5
rushVersion from rush.json? 5.129.6
useWorkspaces from rush.json? true
Operating system? Mac
Would you consider contributing a PR? No
Node.js version (node -v)? 20.12.2
iclanton commented 1 month ago

@aramissennyeydd - Given that you have a repro of this error, would you be able to try to put together a fix?

aramissennyeydd commented 1 month ago

@iclanton I gave it a quick go locally, but I wasn't able to parse through the log writing logic very well. I can take a look, but I'll need some pointers.