Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

src: add get/set pair for env context awareness #35024

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/env-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -513,6 +513,14 @@ inline bool Environment::abort_on_uncaught_exception() const {
return options_->abort_on_uncaught_exception;
}

inline void Environment::set_force_context_aware(bool value) {
options_->force_context_aware = value;
}

inline bool Environment::force_context_aware() const {
return options_->force_context_aware;
}

inline void Environment::set_abort_on_uncaught_exception(bool value) {
options_->abort_on_uncaught_exception = value;
}
Expand Down
3 changes: 3 additions & 0 deletions src/env.h
Original file line number Diff line number Diff line change
Expand Up @@ -1068,6 +1068,9 @@ class Environment : public MemoryRetainer {
void PrintSyncTrace() const;
inline void set_trace_sync_io(bool value);

inline void set_force_context_aware(bool value);
inline bool force_context_aware() const;

// This stores whether the --abort-on-uncaught-exception flag was passed
// to Node.
inline bool abort_on_uncaught_exception() const;
Expand Down
2 changes: 1 addition & 1 deletion src/node_binding.cc
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ void DLOpen(const FunctionCallbackInfo<Value>& args) {

if (mp != nullptr) {
if (mp->nm_context_register_func == nullptr) {
if (env->options()->force_context_aware) {
if (env->force_context_aware()) {
dlib->Close();
THROW_ERR_NON_CONTEXT_AWARE_DISABLED(env);
return false;
Expand Down