Index: runtime/bin/file.cc |
diff --git a/runtime/bin/file.cc b/runtime/bin/file.cc |
index cfd5637081825afb93952ffa2de98ce89d49c6d2..1face6bf2a05bde599393a7e6dd3b809b9f2be20 100644 |
--- a/runtime/bin/file.cc |
+++ b/runtime/bin/file.cc |
@@ -6,6 +6,7 @@ |
#include "bin/builtin.h" |
#include "bin/dartutils.h" |
+#include "bin/embedded_dart_io.h" |
#include "bin/io_buffer.h" |
#include "bin/utils.h" |
@@ -18,13 +19,31 @@ namespace bin { |
static const int kMSPerSecond = 1000; |
// Are we capturing output from stdout for the VM service? |
-bool File::capture_stdout_ = false; |
+static bool capture_stdout = false; |
// Are we capturing output from stderr for the VM service? |
-bool File::capture_stderr_ = false; |
+static bool capture_stderr = false; |
+ |
+ |
+void SetCaptureStdout(bool value) { |
+ capture_stdout = value; |
+} |
+ |
+ |
+void SetCaptureStderr(bool value) { |
+ capture_stderr = value; |
+} |
+ |
+ |
+bool ShouldCaptureStdout() { |
+ return capture_stdout; |
+} |
+ |
+ |
+bool ShouldCaptureStderr() { |
+ return capture_stderr; |
+} |
-// Are we capturing output from either stdout or stderr for the VM Service? |
-bool File::capture_any_ = false; |
// The file pointer has been passed into Dart as an intptr_t and it is safe |
@@ -62,13 +81,13 @@ bool File::WriteFully(const void* buffer, int64_t num_bytes) { |
remaining -= bytes_written; // Reduce the number of remaining bytes. |
current_buffer += bytes_written; // Move the buffer forward. |
} |
- if (capture_any_) { |
+ if (capture_stdout || capture_stderr) { |
intptr_t fd = GetFD(); |
- if (fd == STDOUT_FILENO && capture_stdout_) { |
+ if (fd == STDOUT_FILENO && capture_stdout) { |
Dart_ServiceSendDataEvent("Stdout", "WriteEvent", |
reinterpret_cast<const uint8_t*>(buffer), |
num_bytes); |
- } else if (fd == STDERR_FILENO && capture_stderr_) { |
+ } else if (fd == STDERR_FILENO && capture_stderr) { |
Dart_ServiceSendDataEvent("Stderr", "WriteEvent", |
reinterpret_cast<const uint8_t*>(buffer), |
num_bytes); |