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

Add Env::RunScript #616

Closed
wants to merge 1 commit into from
Closed

Conversation

tniessen
Copy link
Member

@tniessen tniessen commented Dec 1, 2019

This is a thin wrapper around napi_run_script. I don't feel strongly about this addition, but if we do want to add it, it might be worth considering using Napi::String instead of Napi::Value for the script parameter. (I wasn't sure which one to pick.)

Refs: nodejs/node#15216

Copy link
Member

@NickNaso NickNaso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just some suggestions

doc/env.md Outdated Show resolved Hide resolved
doc/env.md Outdated Show resolved Hide resolved
Copy link
Member

@NickNaso NickNaso left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@devsnek
Copy link
Member

devsnek commented Dec 2, 2019

I think this should definitely take a Napi::String.

This is a thin wrapper around napi_run_script.

Refs: nodejs/node#15216
@tniessen
Copy link
Member Author

tniessen commented Dec 2, 2019

@devsnek Done.

@KevinEady
Copy link
Contributor

KevinEady commented Dec 2, 2019

Sorry to jump in late, buuuut ... I think it should take an napi_value because the actual napi_run_script method takes an napi_value, and in order to avoid semantic differences between underlying napi and our C++ wrapper (eg. #594), I think we should try to stick close to napi as possible. Plus, the current napi implementation already handles non-String values as errors -- I don't think it's something that node-addon-api needs to handle separately.

I take back everything above. The added enforcement of type-checking is a 👍 provided by node-addon-api. Sorry for flip-flops!

Copy link
Member

@mhdawson mhdawson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@KevinEady KevinEady left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

gabrielschulhof pushed a commit that referenced this pull request Dec 14, 2019
This is a thin wrapper around napi_run_script.

Refs: nodejs/node#15216
PR-URL: #616
Reviewed-By: Nicola Del Gobbo <nicoladelgobbo@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Kevin Eady <kevin.c.eady@gmail.com>
Reviewed-By: Kevin Eady <kevin.c.eady@gmail.com>
@gabrielschulhof
Copy link
Contributor

Landed in d2dd580.

gabrielschulhof pushed a commit that referenced this pull request Dec 14, 2019
This is a thin wrapper around napi_run_script.

Refs: nodejs/node#15216
PR-URL: #616
Reviewed-By: Nicola Del Gobbo <nicoladelgobbo@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Kevin Eady <kevin.c.eady@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
@gabrielschulhof
Copy link
Contributor

Had to force-push to fix a commit-message copy/paste error. Landed in ffc71ed.

@tniessen tniessen deleted the add-env-run-script branch January 23, 2020 03:47
kevindavies8 added a commit to kevindavies8/node-addon-api-Develop that referenced this pull request Aug 24, 2022
This is a thin wrapper around napi_run_script.

Refs: nodejs/node#15216
PR-URL: nodejs/node-addon-api#616
Reviewed-By: Nicola Del Gobbo <nicoladelgobbo@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Kevin Eady <kevin.c.eady@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Marlyfleitas added a commit to Marlyfleitas/node-api-addon-Development that referenced this pull request Aug 26, 2022
This is a thin wrapper around napi_run_script.

Refs: nodejs/node#15216
PR-URL: nodejs/node-addon-api#616
Reviewed-By: Nicola Del Gobbo <nicoladelgobbo@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Kevin Eady <kevin.c.eady@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
wroy7860 added a commit to wroy7860/addon-api-benchmark-node that referenced this pull request Sep 19, 2022
This is a thin wrapper around napi_run_script.

Refs: nodejs/node#15216
PR-URL: nodejs/node-addon-api#616
Reviewed-By: Nicola Del Gobbo <nicoladelgobbo@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Kevin Eady <kevin.c.eady@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
johnfrench3 pushed a commit to johnfrench3/node-addon-api-git that referenced this pull request Aug 11, 2023
This is a thin wrapper around napi_run_script.

Refs: nodejs/node#15216
PR-URL: nodejs/node-addon-api#616
Reviewed-By: Nicola Del Gobbo <nicoladelgobbo@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Kevin Eady <kevin.c.eady@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants