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

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: tidy up 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
Index: runtime/bin/main.cc
diff --git a/runtime/bin/main.cc b/runtime/bin/main.cc
index cebd7e676ceb80d2f5c2a101db8992316311f70d..44e32763b3a1566870e6d11636a2fe70f44c0d83 100644
--- a/runtime/bin/main.cc
+++ b/runtime/bin/main.cc
@@ -859,6 +859,37 @@ static const char* ServiceGetIOHandler(
}
+extern bool captureStdio;
+extern bool captureStdout;
+extern bool captureStderr;
+static const char* kStdoutStreamId = "Stdout";
+static const char* kStderrStreamId = "Stderr";
+
+
+static bool ServiceStreamListenCallback(const char* stream_id) {
+ if (strcmp(stream_id, kStdoutStreamId) == 0) {
+ captureStdio = true;
+ captureStdout = true;
+ return true;
+ } else if (strcmp(stream_id, kStderrStreamId) == 0) {
+ captureStdio = true;
+ captureStderr = true;
+ return true;
+ }
+ return false;
+}
+
+
+static void ServiceStreamCancelCallback(const char* stream_id) {
+ if (strcmp(stream_id, kStdoutStreamId) == 0) {
+ captureStdout = false;
+ } else if (strcmp(stream_id, kStderrStreamId) == 0) {
+ captureStderr = false;
+ }
+ captureStdio = (captureStdout || captureStderr);
+}
+
+
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.

Powered by Google App Engine
This is Rietveld 408576698