@@ -175,51 +175,51 @@ const makeTerminalProcessInspector = Effect.gen(function* () {
175175 ) ;
176176 } ) ;
177177
178- const inspect : TerminalProcessInspectorShape [ "inspect" ] = Effect . fn ( "process.inspect" ) (
179- function * ( terminalPid : number ) {
180- if ( ! Number . isInteger ( terminalPid ) || terminalPid <= 0 ) {
181- return {
182- hasRunningSubprocess : false ,
183- runningPorts : [ ] ,
184- } satisfies TerminalSubprocessActivity ;
185- }
186-
187- if ( process . platform === "win32" ) {
188- const childPids = yield * collectWindowsChildPids ( terminalPid , runInspectorCommand ) ;
189- const processPidsForPortScan = [ terminalPid , ...childPids ] ;
190- const runningPorts = yield * checkWindowsListeningPorts ( processPidsForPortScan , {
191- terminalPid,
192- runCommand : runInspectorCommand ,
193- } ) ;
194- return {
195- hasRunningSubprocess : childPids . length > 0 || runningPorts . length > 0 ,
196- runningPorts,
197- } satisfies TerminalSubprocessActivity ;
198- }
199-
200- const processFamilyPids = yield * collectPosixProcessFamilyPids (
201- terminalPid ,
202- runInspectorCommand ,
203- ) ;
204- if ( processFamilyPids . length === 0 ) {
205- return {
206- hasRunningSubprocess : false ,
207- runningPorts : [ ] ,
208- } satisfies TerminalSubprocessActivity ;
209- }
178+ const inspect : TerminalProcessInspectorShape [ "inspect" ] = Effect . fn ( "process.inspect" ) ( function * (
179+ terminalPid : number ,
180+ ) {
181+ if ( ! Number . isInteger ( terminalPid ) || terminalPid <= 0 ) {
182+ return {
183+ hasRunningSubprocess : false ,
184+ runningPorts : [ ] ,
185+ } satisfies TerminalSubprocessActivity ;
186+ }
210187
211- const subprocessPids = processFamilyPids . filter ( ( pid : number ) => pid !== terminalPid ) ;
212- const runningPorts = yield * checkPosixListeningPorts ( processFamilyPids , {
188+ if ( process . platform === "win32" ) {
189+ const childPids = yield * collectWindowsChildPids ( terminalPid , runInspectorCommand ) ;
190+ const processPidsForPortScan = [ terminalPid , ...childPids ] ;
191+ const runningPorts = yield * checkWindowsListeningPorts ( processPidsForPortScan , {
213192 terminalPid,
214193 runCommand : runInspectorCommand ,
215- platform : process . platform ,
216194 } ) ;
217195 return {
218- hasRunningSubprocess : subprocessPids . length > 0 || runningPorts . length > 0 ,
196+ hasRunningSubprocess : childPids . length > 0 || runningPorts . length > 0 ,
219197 runningPorts,
220198 } satisfies TerminalSubprocessActivity ;
221- } ,
222- ) ;
199+ }
200+
201+ const processFamilyPids = yield * collectPosixProcessFamilyPids (
202+ terminalPid ,
203+ runInspectorCommand ,
204+ ) ;
205+ if ( processFamilyPids . length === 0 ) {
206+ return {
207+ hasRunningSubprocess : false ,
208+ runningPorts : [ ] ,
209+ } satisfies TerminalSubprocessActivity ;
210+ }
211+
212+ const subprocessPids = processFamilyPids . filter ( ( pid : number ) => pid !== terminalPid ) ;
213+ const runningPorts = yield * checkPosixListeningPorts ( processFamilyPids , {
214+ terminalPid,
215+ runCommand : runInspectorCommand ,
216+ platform : process . platform ,
217+ } ) ;
218+ return {
219+ hasRunningSubprocess : subprocessPids . length > 0 || runningPorts . length > 0 ,
220+ runningPorts,
221+ } satisfies TerminalSubprocessActivity ;
222+ } ) ;
223223
224224 return {
225225 inspect,
0 commit comments