Chromium Code Reviews| Index: runtime/bin/main.cc |
| =================================================================== |
| --- runtime/bin/main.cc (revision 14903) |
| +++ runtime/bin/main.cc (working copy) |
| @@ -17,6 +17,7 @@ |
| #include "bin/extensions.h" |
| #include "bin/file.h" |
| #include "bin/isolate_data.h" |
| +#include "bin/log.h" |
| #include "bin/platform.h" |
| #include "bin/process.h" |
| #include "platform/globals.h" |
| @@ -142,7 +143,7 @@ |
| } |
| } |
| if (debug_port == 0) { |
| - fprintf(stderr, "unrecognized --debug option syntax. " |
| + Log::PrintErr("unrecognized --debug option syntax. " |
| "Use --debug[:<port number>]\n"); |
| return false; |
| } |
| @@ -516,25 +517,25 @@ |
| static void PrintVersion() { |
| - fprintf(stderr, "Dart VM version: %s\n", Dart_VersionString()); |
| + Log::PrintErr("Dart VM version: %s\n", Dart_VersionString()); |
| } |
| static void PrintUsage() { |
| - fprintf(stderr, |
| + Log::PrintErr( |
| "Usage: dart [<vm-flags>] <dart-script-file> [<dart-options>]\n" |
| "\n" |
| "Executes the Dart script passed as <dart-script-file>.\n" |
| "\n"); |
| if (!has_verbose_option) { |
| - fprintf(stderr, |
| + Log::PrintErr( |
| "Common options:\n" |
| "--checked Insert runtime type checks and enable assertions (checked mode).\n" |
| "--version Print the VM version.\n" |
| "--help Display this message (add --verbose for information about all\n" |
| " VM options).\n"); |
| } else { |
| - fprintf(stderr, |
| + Log::PrintErr( |
| "Supported options:\n" |
| "--checked\n" |
| " Insert runtime type checks and enable assertions (checked mode).\n" |
| @@ -624,10 +625,12 @@ |
| static int ErrorExit(const char* format, ...) { |
| + char buf[1024]; |
|
Ivan Posva
2012/11/15 07:43:17
This will make lots of users very unhappy. As the
siva
2012/11/15 18:46:48
I agree, in fact we had a bug filed against us for
gram
2012/11/15 21:16:50
Done.
gram
2012/11/15 21:16:50
Done.
|
| va_list arguments; |
| va_start(arguments, format); |
| - vfprintf(stderr, format, arguments); |
| + vsnprintf(buf, sizeof(buf), format, arguments); |
|
Ivan Posva
2012/11/15 18:59:44
Why not use Log::VFPrint here?
gram
2012/11/15 21:16:50
Done.
|
| va_end(arguments); |
| + Log::PrintErr("%s", buf); |
| Dart_ExitScope(); |
| Dart_ShutdownIsolate(); |
| @@ -653,7 +656,7 @@ |
| // Perform platform specific initialization. |
| if (!Platform::Initialize()) { |
| - fprintf(stderr, "Initialization failed\n"); |
| + Log::PrintErr("Initialization failed\n"); |
| } |
| // On Windows, the argv strings are code page encoded and not |
| @@ -710,7 +713,7 @@ |
| "main", |
| new IsolateData(), |
| &error)) { |
| - fprintf(stderr, "%s\n", error); |
| + Log::PrintErr("%s\n", error); |
| free(error); |
| delete [] isolate_name; |
| return kErrorExitCode; // Indicates we encountered an error. |