Await the tests/target and tests/trybuild probes in cleanup - #387
Open
jeremy wants to merge 1 commit into
Open
Conversation
`cleanProfileTarget` probes `tests/target` and `tests/trybuild` inside
`try {} catch {}` blocks, but calls `cleanTargetDir` without `await`.
`cleanTargetDir` is async and opens the directory with
`fs.promises.opendir` as its first step, so when either directory is
absent the rejection is never caught by the surrounding `try` and
surfaces as an unhandled promise rejection. The GitHub runner prints it
as an error annotation on the job:
Error: ENOENT: no such file or directory, opendir '.../tests/trybuild'
This happens for any crate whose `target/` contains a directory named
`tests` without those nested dirs, e.g. the crate `cargo package`
unpacks under `target/package/<crate>-<version>/tests`. The job still
succeeds, but each probe leaves two annotations behind.
Awaiting both calls lets the existing `catch` swallow the ENOENT as
intended.
`dist/` is rebuilt with `npm run prepare`. Beyond the two `await`s in
the cleanup chunk, this also strips the CRLF line endings that Swatinem#377
committed in the large cache chunk without running `linefix`, which is
why `check-dist` has been failing on master since then.
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.
In
cleanProfileTarget, thetestsbranch probestests/targetandtests/trybuildinsidetry {} catch {}blocks, but callscleanTargetDirwithoutawait.cleanTargetDiris async and its first step isfs.promises.opendir(targetDir), so when either directory is missing the rejection escapes thetryas an unhandled promise rejection. The runner prints it as an error annotation on the job:Any crate whose
target/contains a directory namedtestswithout those nested dirs triggers it, e.g. the unpacked cratecargo packageleaves attarget/package/<crate>-<version>/tests. The job still succeeds, but each probe adds two annotations. Example at v2.9.2 (6323deb), 8 annotations across two jobs: https://github.com/basecamp/hey-sdk/actions/runs/34460215462This adds
awaitto both calls so the existingcatchswallows the ENOENT as intended. Nothing else insrc/changes.dist/is rebuilt withnpm run prepare. The cleanup chunk differs only by the twoawaits; the large cache chunk also loses the CRLF line endings that #377 committed without runninglinefix, which is whycheck-disthas been failing on master since then (https://github.com/Swatinem/rust-cache/actions/runs/31616391478).diff -wbetween the old and new cache chunks is empty.