build: safeguard terminal styling in devkit admin script#32896
Merged
clydin merged 1 commit intoangular:mainfrom Mar 30, 2026
Merged
build: safeguard terminal styling in devkit admin script#32896clydin merged 1 commit intoangular:mainfrom
clydin merged 1 commit intoangular:mainfrom
Conversation
Prior to this change, if an unhandled promise rejection or error occurred that lacked a `stack` property, the `console.error` wrapper in `devkit-admin.mts` would receive `undefined`. Attempting to pass `undefined` to Node`s `util.styleText` caused an unexpected `ERR_INVALID_ARG_TYPE` crash instead of printing the original error. This commit updates the `console.warn` and `console.error` overrides to ensure they only apply `styleText` to strings. It also updates the top-level try-catch block to fallback to the original error object if `err.stack` is undefined, preventing silent suppression.
There was a problem hiding this comment.
Code Review
This pull request updates scripts/devkit-admin.mts to apply terminal styling to console.warn and console.error outputs and improves error logging by falling back to the error object if the stack trace is missing. The review feedback highlights a potential crash when using styleText in non-TTY environments and recommends verifying process.stdout.isTTY before applying styles.
alan-agius4
approved these changes
Mar 30, 2026
Member
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Prior to this change, if an unhandled promise rejection or error occurred that lacked a
stackproperty, theconsole.errorwrapper indevkit-admin.mtswould receiveundefined. Attempting to passundefinedto Node'sutil.styleTextcaused an unexpectedERR_INVALID_ARG_TYPEcrash instead of printing the original error.This commit updates the
console.warnandconsole.erroroverrides to ensure they only applystyleTextto strings. It also updates the top-level try-catch block to fallback to the original error object iferr.stackis undefined, preventing silent suppression.