Skip to content

Commit 7dd6139

Browse files
committed
fix: changes for FFI API in Deno 1.44
See: denoland/deno#23981
1 parent 28fd93d commit 7dd6139

File tree

3 files changed

+12
-3
lines changed

3 files changed

+12
-3
lines changed

client.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,9 @@ export async function connect(
8181
null,
8282
);
8383
assertResult(
84-
Deno.UnsafePointer.value(hFile) !== C.INVALID_HANDLE_VALUE,
84+
!(C.INVALID_HANDLE_VALUE as readonly (number | bigint)[]).includes(
85+
Deno.UnsafePointer.value(hFile),
86+
),
8587
`CreateFile failed: ${path}`,
8688
);
8789
return new NamedPipeClientConn(path, hFile);

constants.ts

+6-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
export const INVALID_HANDLE_VALUE = -1n;
1+
export const INVALID_HANDLE_VALUE = [
2+
0xffff_ffff_ffff_ffffn,
3+
// NOTE: Prior to Deno 1.44, -1n was returned as the error handle.
4+
// See: https://github.com/denoland/deno/pull/23981
5+
-1n,
6+
] as const;
27

38
export const ERROR_SUCCESS = 0;
49
export const ERROR_BROKEN_PIPE = 109;

server.ts

+3-1
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,9 @@ function createNamedPipe(params: Required<NamedPipeListenOptions>) {
215215
null,
216216
);
217217
assertResult(
218-
Deno.UnsafePointer.value(handle) !== C.INVALID_HANDLE_VALUE,
218+
!(C.INVALID_HANDLE_VALUE as readonly (number | bigint)[]).includes(
219+
Deno.UnsafePointer.value(handle),
220+
),
219221
`CreateNamedPipe failed: ${path}`,
220222
);
221223
return handle;

0 commit comments

Comments
 (0)