Skip to content

Commit 3e59fa5

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

File tree

1 file changed

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

1 file changed

+7
-4
lines changed

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

+7-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,15 @@ 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+
resolve(true);
40+
} catch (_err) {}
3841
} else if (counter > MAX_COUNTER) {
3942
clearInterval(intervalId);
4043
reject("Subprocess was not executed in the expected time");
4144
}
42-
}, 100);
45+
}, 50);
4346
});
4447
}

0 commit comments

Comments
 (0)