File tree 2 files changed +11
-7
lines changed
src/internal/cli/telemetry
test/internal/cli/telemetry
2 files changed +11
-7
lines changed Original file line number Diff line number Diff line change @@ -47,15 +47,15 @@ export async function isTelemetryAllowed(): Promise<boolean> {
47
47
return false ;
48
48
}
49
49
50
- const consent = await getTelemetryConsent ( ) ;
51
-
52
50
// ATTENTION: only for testing
53
51
if ( process . env . HARDHAT_TEST_TELEMETRY_CONSENT_VALUE !== undefined ) {
54
52
return process . env . HARDHAT_TEST_TELEMETRY_CONSENT_VALUE === "true"
55
53
? true
56
54
: false ;
57
55
}
58
56
57
+ const consent = await getTelemetryConsent ( ) ;
58
+
59
59
return consent !== undefined ? consent : false ;
60
60
}
61
61
@@ -72,7 +72,8 @@ export function isTelemetryAllowedInEnvironment(): boolean {
72
72
( ! isCi ( ) &&
73
73
process . stdout . isTTY === true &&
74
74
process . env . HARDHAT_DISABLE_TELEMETRY_PROMPT !== "true" ) ||
75
- process . env . HARDHAT_TEST_INTERACTIVE_ENV === "true" // Used in tests to force telemetry execution
75
+ // ATTENTION: used in tests to force telemetry execution
76
+ process . env . HARDHAT_TEST_INTERACTIVE_ENV === "true"
76
77
) ;
77
78
}
78
79
Original file line number Diff line number Diff line change 1
1
import path from "node:path" ;
2
2
3
- import { exists } from "@ignored/hardhat-vnext-utils/fs" ;
3
+ import { exists , readUtf8File } from "@ignored/hardhat-vnext-utils/fs" ;
4
4
5
5
export const ROOT_PATH_TO_FIXTURE : string = path . join (
6
6
process . cwd ( ) ,
@@ -33,12 +33,15 @@ export async function checkIfSubprocessWasExecuted(
33
33
counter ++ ;
34
34
35
35
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 ) { }
38
41
} else if ( counter > MAX_COUNTER ) {
39
42
clearInterval ( intervalId ) ;
40
43
reject ( "Subprocess was not executed in the expected time" ) ;
41
44
}
42
- } , 100 ) ;
45
+ } , 50 ) ;
43
46
} ) ;
44
47
}
You can’t perform that action at this time.
0 commit comments