@@ -1002,6 +1002,7 @@ effectIt.effect.each(["linux", "darwin"] as const)(
10021002 const agentListener = `p4242\ncnode\nn127.0.0.1:${ agentPort } \n` ;
10031003 const otherListener = `p5000\ncpostgres\nn127.0.0.1:${ otherPort } \n` ;
10041004 let lsofStdout = `${ agentListener } ${ otherListener } ` ;
1005+ let lsofFails = false ;
10051006 let lsofCalls = 0 ;
10061007 let environmentReads = 0 ;
10071008 const requests : string [ ] = [ ] ;
@@ -1025,7 +1026,16 @@ effectIt.effect.each(["linux", "darwin"] as const)(
10251026 run : ( input ) => {
10261027 if ( input . command === "lsof" ) {
10271028 lsofCalls += 1 ;
1028- return Effect . succeed ( processOutput ( lsofStdout ) ) ;
1029+ return lsofFails
1030+ ? Effect . fail (
1031+ new ProcessRunner . ProcessTimeoutError ( {
1032+ command : input . command ,
1033+ argumentCount : input . args . length ,
1034+ cwd : input . cwd ,
1035+ timeoutMs : 5_000 ,
1036+ } ) ,
1037+ )
1038+ : Effect . succeed ( processOutput ( lsofStdout ) ) ;
10291039 }
10301040 // A direct child of this process, so stop refuses it without signaling anything.
10311041 if ( input . args [ 0 ] === "-A" ) {
@@ -1060,8 +1070,12 @@ effectIt.effect.each(["linux", "darwin"] as const)(
10601070 expect ( yield * scanner . scan ( ) ) . toEqual ( [ ] ) ;
10611071 expect ( lsofCalls ) . toBe ( 0 ) ;
10621072
1063- // The agent exits before any client looks; its server is still found.
1073+ // The agent exits before any client looks, and the first read fails; its server is still
1074+ // found.
10641075 scanner . trackAgent ( ) ( ) ;
1076+ lsofFails = true ;
1077+ expect ( yield * scanner . scan ( ) ) . toEqual ( [ ] ) ;
1078+ lsofFails = false ;
10651079 expect ( yield * scanner . scan ( ) ) . toMatchObject ( [
10661080 { port : agentPort , pid : 4242 , terminal : null , agent : { threadId : "thread-agent" } } ,
10671081 ] ) ;
0 commit comments