@@ -120,6 +120,8 @@ static Persistent<String> disposed_symbol;
120120
121121static bool print_eval = false ;
122122static bool force_repl = false ;
123+ static bool no_deprecation = false ;
124+ static bool trace_deprecation = false ;
123125static char *eval_string = NULL ;
124126static int option_end_index = 0 ;
125127static bool use_debug_agent = false ;
@@ -1094,12 +1096,16 @@ enum encoding ParseEncoding(Handle<Value> encoding_v, enum encoding _default) {
10941096 } else if (strcasecmp (*encoding, " hex" ) == 0 ) {
10951097 return HEX;
10961098 } else if (strcasecmp (*encoding, " raw" ) == 0 ) {
1097- fprintf (stderr, " 'raw' (array of integers) has been removed. "
1098- " Use 'binary'.\n " );
1099+ if (!no_deprecation) {
1100+ fprintf (stderr, " 'raw' (array of integers) has been removed. "
1101+ " Use 'binary'.\n " );
1102+ }
10991103 return BINARY;
11001104 } else if (strcasecmp (*encoding, " raws" ) == 0 ) {
1101- fprintf (stderr, " 'raws' encoding has been renamed to 'binary'. "
1102- " Please update your code.\n " );
1105+ if (!no_deprecation) {
1106+ fprintf (stderr, " 'raws' encoding has been renamed to 'binary'. "
1107+ " Please update your code.\n " );
1108+ }
11031109 return BINARY;
11041110 } else {
11051111 return _default;
@@ -2224,6 +2230,16 @@ Handle<Object> SetupProcessObject(int argc, char *argv[]) {
22242230 process->Set (String::NewSymbol (" _forceRepl" ), True ());
22252231 }
22262232
2233+ // --no-deprecation
2234+ if (no_deprecation) {
2235+ process->Set (String::NewSymbol (" noDeprecation" ), True ());
2236+ }
2237+
2238+ // --trace-deprecation
2239+ if (trace_deprecation) {
2240+ process->Set (String::NewSymbol (" traceDeprecation" ), True ());
2241+ }
2242+
22272243 size_t size = 2 *PATH_MAX;
22282244 char * execPath = new char [size];
22292245 if (uv_exepath (execPath, &size) != 0 ) {
@@ -2371,6 +2387,8 @@ static void PrintHelp() {
23712387 " -p, --print print result of --eval\n "
23722388 " -i, --interactive always enter the REPL even if stdin\n "
23732389 " does not appear to be a terminal\n "
2390+ " --no-deprecation silence deprecation warnings\n "
2391+ " --trace-deprecation show stack traces on deprecations\n "
23742392 " --v8-options print v8 command line options\n "
23752393 " --max-stack-size=val set max v8 stack size (bytes)\n "
23762394 " \n "
@@ -2428,6 +2446,12 @@ static void ParseArgs(int argc, char **argv) {
24282446 argv[i] = const_cast <char *>(" " );
24292447 } else if (strcmp (arg, " --v8-options" ) == 0 ) {
24302448 argv[i] = const_cast <char *>(" --help" );
2449+ } else if (strcmp (arg, " --no-deprecation" ) == 0 ) {
2450+ argv[i] = const_cast <char *>(" " );
2451+ no_deprecation = true ;
2452+ } else if (strcmp (arg, " --trace-deprecation" ) == 0 ) {
2453+ argv[i] = const_cast <char *>(" " );
2454+ trace_deprecation = true ;
24312455 } else if (argv[i][0 ] != ' -' ) {
24322456 break ;
24332457 }
0 commit comments