Attempt to fix 'spawn error' on Windows tests

This commit is contained in:
Ashcon Partovi
2024-07-29 19:15:36 -07:00
parent 8efcc61a7b
commit 9b8340a5b3

View File

@@ -104,15 +104,19 @@ async function printInfo() {
console.log("Glibc:", getGlibcVersion());
}
console.log("Hostname:", getHostname());
if (isCloud) {
console.log("Public IP:", await getPublicIp());
console.log("Cloud:", getCloud());
}
if (isCI) {
console.log("CI:", getCI());
console.log("Shard:", options["shard"], "/", options["max-shards"]);
console.log("Build URL:", getBuildUrl());
console.log("Environment:", process.env);
if (isCloud) {
console.log("Public IP:", await getPublicIp());
console.log("Cloud:", getCloud());
}
const tailscaleIp = await getTailscaleIp();
if (tailscaleIp) {
console.log("Tailscale IP:", tailscaleIp);
}
}
console.log("Cwd:", cwd);
console.log("Tmpdir:", tmpPath);
@@ -136,6 +140,30 @@ async function runTests() {
}
console.log("Bun:", execPath);
for (let i = 0; i < 10; i++) {
try {
const { error } = spawnSync(execPath, ["--version"], {
encoding: "utf-8",
timeout: spawnTimeout,
env: {
PATH: process.env.PATH,
BUN_DEBUG_QUIET_LOGS: 1,
},
});
if (!error) {
break;
}
throw error;
} catch (error) {
const { code } = error;
if (code === "EBUSY" || code === "UNKNOWN") {
console.log(`Bun appears to be busy, retrying... [code: ${code}]`);
await new Promise(resolve => setTimeout(resolve, 1000 * (i + 1)));
continue;
}
}
}
const revision = getRevision(execPath);
console.log("Revision:", revision);
@@ -973,7 +1001,7 @@ async function getExecPathFromBuildKite(target) {
if (isWindows) {
await spawnSafe({
command: "powershell",
args: ["-Command", `Expand-Archive -Path ${zipPath} -DestinationPath ${releasePath}`],
args: ["-Command", `Expand-Archive -Path ${zipPath} -DestinationPath ${releasePath} -Force`],
});
} else {
await spawnSafe({
@@ -1298,6 +1326,26 @@ async function getPublicIp() {
}
}
/**
* @returns {string | undefined}
*/
function getTailscaleIp() {
try {
const { status, stdout } = spawnSync("tailscale", ["ip", "--1"], {
encoding: "utf-8",
timeout: spawnTimeout,
env: {
PATH: process.env.PATH,
},
});
if (status === 0) {
return stdout.trim();
}
} catch {
// ...
}
}
/**
* @param {...string} paths
* @returns {string}