@@ -141,6 +141,8 @@ const INSTALL_LOCK_RETRY_DELAY = "100 millis";
141141// Legacy locks have no owner; allow both ten-minute download stages and the install tail.
142142const INSTALL_LOCK_LEGACY_STALE_MS = 30 * 60 * 1_000 ;
143143const VERSION_PROBE_TIMEOUT = "10 seconds" ;
144+ // Antivirus scans can hold the first launch of a freshly downloaded binary for 20-30 s.
145+ const INSTALL_VALIDATION_TIMEOUT = "2 minutes" ;
144146
145147const ACTIVATE_RETRY_COUNT = 40 ;
146148const ACTIVATE_RETRY_DELAY = "250 millis" ;
@@ -299,19 +301,23 @@ export const makeCloudflaredRelayClient = Effect.fn("cloudflared.make")(function
299301 return platform === "win32" || ( info . value . mode & 0o111 ) !== 0 ;
300302 } ) ;
301303
304+ const runVersionProbe = Effect . fn ( "cloudflared.runVersionProbe" ) ( function * (
305+ executablePath : string ,
306+ timeout : Duration . Input ,
307+ ) {
308+ return yield * spawner
309+ . string ( ChildProcess . make ( executablePath , [ "version" ] , { stdin : "ignore" , stderr : "ignore" } ) )
310+ . pipe (
311+ Effect . map ( parseCloudflaredVersionOutput ) ,
312+ Effect . timeoutOption ( timeout ) ,
313+ Effect . map ( Option . getOrNull ) ,
314+ Effect . orElseSucceed ( ( ) => null ) ,
315+ ) ;
316+ } ) ;
317+
302318 // Cache successful version probes per file revision; do not let transient failures hide valid binaries.
303319 const versionCache = yield * Cache . makeWith (
304- ( key : VersionProbeKey ) =>
305- spawner
306- . string (
307- ChildProcess . make ( key . executablePath , [ "version" ] , { stdin : "ignore" , stderr : "ignore" } ) ,
308- )
309- . pipe (
310- Effect . map ( parseCloudflaredVersionOutput ) ,
311- Effect . timeoutOption ( VERSION_PROBE_TIMEOUT ) ,
312- Effect . map ( Option . getOrNull ) ,
313- Effect . orElseSucceed ( ( ) => null ) ,
314- ) ,
320+ ( key : VersionProbeKey ) => runVersionProbe ( key . executablePath , VERSION_PROBE_TIMEOUT ) ,
315321 {
316322 capacity : 16 ,
317323 timeToLive : ( exit ) =>
@@ -648,7 +654,7 @@ export const makeCloudflaredRelayClient = Effect.fn("cloudflared.make")(function
648654 }
649655 yield * report ( "validating" ) ;
650656 // Verify the pin so mislabeled assets cannot cause repeated redownloads.
651- const installedVersion = yield * probeVersion ( executablePath ) ;
657+ const installedVersion = yield * runVersionProbe ( executablePath , INSTALL_VALIDATION_TIMEOUT ) ;
652658 if ( installedVersion !== CLOUDFLARED_VERSION ) {
653659 return yield * new RelayClientInstallError ( {
654660 reason : "validation_failed" ,
0 commit comments