Skip to content

Commit f96387c

Browse files
committed
fix(build): use GetCreationContextChecked for node >= 18
1 parent 8909e85 commit f96387c

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
language: node_js
22
node_js:
3+
- "20"
34
- "11"
45
- "8"
56
env:

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "posix-semaphore",
3-
"version": "1.0.0",
3+
"version": "1.0.1",
44
"description": "Blocking POSIX semaphores for Node.js",
55
"repository": "https://github.com/dbousque/posix-semaphore",
66
"license": "MIT",
@@ -14,7 +14,7 @@
1414
},
1515
"devDependencies": {
1616
"child_process": "^1.0.2",
17-
"shm-typed-array": "^0.0.10"
17+
"shm-typed-array": "^0.1.0"
1818
},
1919
"dependencies": {
2020
"bindings": "~1.2.1",

srcs/semaphore.cc

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,12 @@ Semaphore::~Semaphore()
2727

2828
void Semaphore::Init(v8::Local<v8::Object> exports)
2929
{
30+
#if NODE_MAJOR_VERSION >= 18
31+
v8::Local<v8::Context> context = exports->GetCreationContextChecked();
32+
#else
3033
v8::Local<v8::Context> context = exports->CreationContext();
34+
#endif
35+
3136
Nan::HandleScope scope;
3237

3338
// Prepare constructor template

0 commit comments

Comments
 (0)