[dart_runner] Print to stdout as well as logs
FL-225 #done
Modifies the built-in print to print to stdout as well as logs. Continuing to
print to logs for parity with Flutter; however, printing to logs via the
runner's stdout may not be sound and may warrant a proper fix in the future.
Test: fx run-test driver_example_mod_tests
fx run-test dart_app_service_tests
Observed test output in stdout (00:05 +2: All tests passed!)
Change-Id: I67c5898ec0cd93168636b55ddf2d04180d2d7676
diff --git a/runtime/dart_runner/embedder/builtin.dart b/runtime/dart_runner/embedder/builtin.dart
index 5c44650..2e824c6 100644
--- a/runtime/dart_runner/embedder/builtin.dart
+++ b/runtime/dart_runner/embedder/builtin.dart
@@ -5,11 +5,18 @@
library fuchsia_builtin;
import 'dart:async';
+import 'dart:io';
import 'dart:_internal' show VMLibraryHooks;
// Corelib 'print' implementation.
void _print(arg) {
_Logger._printString(arg.toString());
+ try {
+ // If stdout is connected, print to it as well.
+ stdout.writeln(arg);
+ } on FileSystemException catch (_) {
+ // Some Fuchsia applications will not have stdout connected.
+ }
}
class _Logger {