Skip to content

Commit

Permalink
all: update --napi-modules flag to not have a yes/no
Browse files Browse the repository at this point in the history
This updates the documentation, the error message upon module load
failure, the command line option parsing of the flag, and the way
the N-API addon tests pass the flag to node.

Re nodejs/node#11975 (comment)
Re nodejs/node#11975 (comment)
Fixes #184
Closes #186
  • Loading branch information
Gabriel Schulhof committed Mar 22, 2017
1 parent 4176b68 commit ee66ab9
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
7 changes: 7 additions & 0 deletions doc/api/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,13 @@ added: v6.0.0

Silence all process warnings (including deprecations).

### `--napi-modules`
<!-- YAML
added: v8.0.0
-->

Load N-API modules.

### `--trace-warnings`
<!-- YAML
added: v6.0.0
Expand Down
4 changes: 4 additions & 0 deletions doc/node.1
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,10 @@ Throw errors for deprecations.
.BR \-\-no\-warnings
Silence all process warnings (including deprecations).

.TP
.BR \-\-napi\-modules
Load N-API modules.

.TP
.BR \-\-trace\-warnings
Print stack traces for process warnings (including deprecations).
Expand Down
9 changes: 3 additions & 6 deletions src/node.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2471,7 +2471,8 @@ void DLOpen(const FunctionCallbackInfo<Value>& args) {
sizeof(errmsg),
"The module '%s'"
"\nwas compiled against the Node.js API. This feature is "
"\nexperimental and must be enabled on the command-line.",
"\nexperimental and must be enabled on the command-line by "
"\nadding --napi-modules.",
*filename);
} else {
snprintf(errmsg,
Expand Down Expand Up @@ -3548,7 +3549,7 @@ static void PrintHelp() {
" --trace-deprecation show stack traces on deprecations\n"
" --throw-deprecation throw an exception on deprecations\n"
" --no-warnings silence all process warnings\n"
" --napi-modules[=yes|no] load N-API modules (default no)\n"
" --napi-modules load N-API modules\n"
" --trace-warnings show stack traces on process warnings\n"
" --redirect-warnings=path\n"
" write warnings to path instead of\n"
Expand Down Expand Up @@ -3721,10 +3722,6 @@ static void ParseArgs(int* argc,
no_deprecation = true;
} else if (strcmp(arg, "--napi-modules") == 0) {
load_napi_modules = true;
} else if (strcmp(arg, "--napi-modules=yes") == 0) {
load_napi_modules = true;
} else if (strcmp(arg, "--napi-modules=no") == 0) {
load_napi_modules = false;
} else if (strcmp(arg, "--no-warnings") == 0) {
no_process_warnings = true;
} else if (strcmp(arg, "--trace-warnings") == 0) {
Expand Down
2 changes: 1 addition & 1 deletion test/addons-napi/testcfg.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@
import testpy

def GetConfiguration(context, root):
return testpy.AddonTestConfiguration(context, root, 'addons-napi', ['--napi-modules=yes'])
return testpy.AddonTestConfiguration(context, root, 'addons-napi', ['--napi-modules'])

0 comments on commit ee66ab9

Please sign in to comment.