@@ -2,7 +2,7 @@ import type * as CommandExecutor from "@effect/platform/CommandExecutor"
22import type { PlatformError } from "@effect/platform/Error"
33import type { FileSystem } from "@effect/platform/FileSystem"
44import * as Path from "@effect/platform/Path"
5- import { Effect , Option } from "effect"
5+ import { Effect , Either , Option } from "effect"
66
77import { runDockerPsPublishedHostPorts } from "../shell/docker.js"
88import { PortProbeError } from "../shell/errors.js"
@@ -47,14 +47,17 @@ const reservePort = (
4747}
4848
4949const loadPublishedDockerPorts = ( ) : Effect . Effect < ReadonlySet < number > , never , CommandExecutor . CommandExecutor > =>
50- runDockerPsPublishedHostPorts ( process . cwd ( ) ) . pipe (
51- Effect . map ( ( ports ) => new Set ( ports ) ) ,
52- Effect . catchAll ( ( error ) =>
53- Effect . logWarning (
54- `Failed to read published Docker ports; falling back to TCP probing only: ${
55- error instanceof Error ? error . message : String ( error )
56- } `
57- ) . pipe ( Effect . as ( new Set < number > ( ) ) )
50+ Effect . either ( runDockerPsPublishedHostPorts ( process . cwd ( ) ) ) . pipe (
51+ Effect . flatMap (
52+ Either . match ( {
53+ onLeft : ( error ) =>
54+ Effect . logWarning (
55+ `Failed to read published Docker ports; falling back to TCP probing only: ${
56+ error instanceof Error ? error . message : String ( error )
57+ } `
58+ ) . pipe ( Effect . as ( new Set < number > ( ) ) ) ,
59+ onRight : ( ports ) => Effect . succeed ( new Set ( ports ) )
60+ } )
5861 )
5962 )
6063
0 commit comments