Skip to content

Commit

Permalink
Fixes error return
Browse files Browse the repository at this point in the history
  • Loading branch information
Maël Nison authored and addaleax committed Apr 17, 2019
1 parent 1d3d149 commit b659b46
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/node.cc
Expand Up @@ -687,10 +687,9 @@ int InitializeNodeWithArgs(std::vector<std::string>* argv,
// Backslashes escape the following character
if (c == '\\' && is_in_string) {
if (index + 1 == node_options.size()) {
fprintf(stderr,
"%s: invalid escaping for NODE_OPTIONS\n",
argv->at(0).c_str());
exit(9);
errors->push_back("invalid value for NODE_OPTIONS "
"(invalid escape)\n");
return 9;
} else {
c = node_options.at(++index);
}
Expand All @@ -710,6 +709,12 @@ int InitializeNodeWithArgs(std::vector<std::string>* argv,
}
}

if (is_in_string) {
errors->push_back("invalid value for NODE_OPTIONS "
"(unterminated string)\n");
return 9;
}

const int exit_code = ProcessGlobalArgs(&env_argv, nullptr, errors, true);
if (exit_code != 0) return exit_code;
}
Expand Down

0 comments on commit b659b46

Please sign in to comment.