fix: defer cmd log to respect .quiet()/.verbose() overrides#1456
Closed
hobostay wants to merge 1 commit intogoogle:mainfrom
Closed
fix: defer cmd log to respect .quiet()/.verbose() overrides#1456hobostay wants to merge 1 commit intogoogle:mainfrom
hobostay wants to merge 1 commit intogoogle:mainfrom
Conversation
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
When .quiet() or .verbose() is called on a ProcessPromise, the cmd log was emitted before these overrides could take effect. This happened because the start event fires synchronously during run(), which is called before the chained methods execute. Deferring the cmd log with queueMicrotask allows .quiet()/.verbose() to modify the snapshot first, since microtasks run after the current synchronous call stack completes.
70b487e to
216c4b7
Compare
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.
Summary
cmdlog entry inProcessPromise.run()withqueueMicrotask()so that chained.quiet()/.verbose()overrides take effect before the log is emittedProblem
Since PR #914 removed the
setImmediatearoundrun(), thestartevent fires synchronously duringrun(), which is called before chained methods like.quiet()or.verbose()can modify the snapshot. This means thecmdlog entry always uses the original verbose/quiet state, ignoring per-call overrides.Observed behavior:
.quiet()does not suppress the command line output.verbose(false)does not suppress the command line output.quiet(false)does not enable the command line output when$.quiet = true.verbose(true)does not enable the command line output when$.verbose = falseFix
Instead of reverting the
setImmediateremoval (which was needed for pipe splitting), this PR defers only thecmdlog entry usingqueueMicrotask(). This is more targeted:queueMicrotaskruns after the current synchronous call stack completes but before any I/O, so chained methods have already executedTest plan
.quiet()/.verbose()override scenarios from Changed output behavior when using quiet and verbose in version 8.2.0 #931