Skip to content

Commit 0ee1fc5

Browse files
committed
build: avoid WSL interop flake when preparing Windows CI environment
For our native Windows tests (verifying `ng` CLI outside WSL), we currently build the test binaries inside WSL, leveraging bazel remote execution. The scripts involved in moving the built binaries to outside WSL rarely flake due to a WSL interop bug when we invoke Windows commands from inside WSL (which is an untypical thing to do; but a needed trick given some WSL limitation). This commit tries to stabilize/avoid this flake by retrying if we recognize this. (cherry picked from commit 54c561a)
1 parent 935cc1d commit 0ee1fc5

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

scripts/windows-testing/convert-symlinks.mjs

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,10 +119,22 @@ async function transformDir(p) {
119119
}
120120
}
121121

122-
function exec(cmd) {
122+
function exec(cmd, maxRetries = 2) {
123123
return new Promise((resolve, reject) => {
124124
childProcess.exec(cmd, { cwd: rootDir }, (error) => {
125125
if (error !== null) {
126+
// Windows command spawned within WSL (which is untypical) seem to be flaky rarely.
127+
// This logic tries to make it fully stable by re-trying if this surfaces:
128+
// See: https://github.com/microsoft/WSL/issues/8677.
129+
if (
130+
maxRetries > 0 &&
131+
error.stderr !== undefined &&
132+
error.stderr.includes(`accept4 failed 110`)
133+
) {
134+
resolve(exec(cmd, maxRetries - 1));
135+
return;
136+
}
137+
126138
reject(error);
127139
} else {
128140
resolve();

0 commit comments

Comments
 (0)