Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1698)

Unified Diff: runtime/bin/main.cc

Issue 1232193003: Provide stdout and stderr output in the Observatory debugger. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: before commit Created 5 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/bin/file.cc ('k') | runtime/include/dart_tools_api.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/bin/main.cc
diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc
index cebd7e676ceb80d2f5c2a101db8992316311f70d..5b14dff3ec5c9961d3168e07df1ce9a89931f701 100644
--- a/runtime/bin/main.cc
+++ b/runtime/bin/main.cc
@@ -859,6 +859,37 @@ static const char* ServiceGetIOHandler(
}
+extern bool capture_stdio;
+extern bool capture_stdout;
+extern bool capture_stderr;
+static const char* kStdoutStreamId = "Stdout";
+static const char* kStderrStreamId = "Stderr";
+
+
+static bool ServiceStreamListenCallback(const char* stream_id) {
+ if (strcmp(stream_id, kStdoutStreamId) == 0) {
+ capture_stdio = true;
+ capture_stdout = true;
+ return true;
+ } else if (strcmp(stream_id, kStderrStreamId) == 0) {
+ capture_stdio = true;
+ capture_stderr = true;
+ return true;
+ }
+ return false;
+}
+
+
+static void ServiceStreamCancelCallback(const char* stream_id) {
+ if (strcmp(stream_id, kStdoutStreamId) == 0) {
+ capture_stdout = false;
+ } else if (strcmp(stream_id, kStderrStreamId) == 0) {
+ capture_stderr = false;
+ }
+ capture_stdio = (capture_stdout || capture_stderr);
+}
+
+
void main(int argc, char** argv) {
char* script_name;
const int EXTRA_VM_ARGUMENTS = 2;
@@ -947,6 +978,8 @@ void main(int argc, char** argv) {
Dart_RegisterIsolateServiceRequestCallback(
"getIO", &ServiceGetIOHandler, NULL);
+ Dart_SetServiceStreamCallbacks(&ServiceStreamListenCallback,
+ &ServiceStreamCancelCallback);
// Call CreateIsolateAndSetup which creates an isolate and loads up
// the specified application script.
« no previous file with comments | « runtime/bin/file.cc ('k') | runtime/include/dart_tools_api.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698