Skip to content

Commit cbcd220

Browse files
authored
fix: add Deno 2.x compatibility (#48)
fix: add Deno 2.x compatibility
2 parents df91dcd + 541651c commit cbcd220

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

utils/local-ip.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export const getNetworkAddr = async () => {
2323
throw new Error('Could not resolve your local adress.')
2424
}
2525

26-
await Deno.close(ifconfig.rid)
26+
await Deno.close?.(ifconfig.rid) ?? ifconfig.close()
2727

2828
return (
2929
addrs &&
@@ -32,7 +32,7 @@ export const getNetworkAddr = async () => {
3232
?.split('inet ')[1]
3333
)
3434
} catch (err) {
35-
ifconfig && (await Deno.close(ifconfig.rid))
35+
ifconfig && (await Deno.close?.(ifconfig.rid) ?? ifconfig.close())
3636
console.log(err.message)
3737
}
3838
}

0 commit comments

Comments
 (0)