Skip to content

Commit f556dd2

Browse files
modify helper: wait for subprocess file to be readable
1 parent f1c7c7d commit f556dd2

File tree

1 file changed

+6
-4
lines changed
  • v-next/hardhat/test/internal/cli/telemetry

1 file changed

+6
-4
lines changed

v-next/hardhat/test/internal/cli/telemetry/helpers.ts

+6-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import path from "node:path";
22

3-
import { exists } from "@ignored/hardhat-vnext-utils/fs";
3+
import { exists, readUtf8File } from "@ignored/hardhat-vnext-utils/fs";
44

55
export const ROOT_PATH_TO_FIXTURE: string = path.join(
66
process.cwd(),
@@ -33,12 +33,14 @@ export async function checkIfSubprocessWasExecuted(
3333
counter++;
3434

3535
if (await exists(resultFilePath)) {
36-
clearInterval(intervalId);
37-
resolve(true);
36+
try {
37+
await readUtf8File(resultFilePath); // Wait for the file to be readable
38+
clearInterval(intervalId);
39+
} catch (_err) {}
3840
} else if (counter > MAX_COUNTER) {
3941
clearInterval(intervalId);
4042
reject("Subprocess was not executed in the expected time");
4143
}
42-
}, 100);
44+
}, 50);
4345
});
4446
}

0 commit comments

Comments
 (0)