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

Unified Diff: runtime/bin/process.h

Issue 21816002: Add Process.runSync for running processe synchronously. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixed Mac OS issue Created 7 years, 4 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/process.h
diff --git a/runtime/bin/process.h b/runtime/bin/process.h
index 8e82f394aa7d8eac25b69d262f1cb36937508708..230b1b7cb2fc4a28a250a4f5b4243486f31c7f79 100644
--- a/runtime/bin/process.h
+++ b/runtime/bin/process.h
@@ -13,6 +13,41 @@
namespace dart {
namespace bin {
+class ProcessResult {
+ public:
+ ProcessResult()
+ : stdout_data_(NULL), stdout_length_(0),
+ stderr_data_(NULL), stderr_length_(0), exit_code_(0) {}
+
+ void SetStdoutData(uint8_t* buffer, intptr_t length) {
+ stdout_data_ = buffer;
+ stdout_length_ = length;
+ }
+
+ void SetStderrData(uint8_t* buffer, intptr_t length) {
+ stderr_data_ = buffer;
+ stderr_length_ = length;
+ }
+
+ void set_exit_code(intptr_t exit_code) { exit_code_ = exit_code; }
+
+ uint8_t* stdout_data() { return stdout_data_; }
+ intptr_t stdout_length() { return stdout_length_; }
+ uint8_t* stderr_data() { return stderr_data_; }
+ intptr_t stderr_length() { return stderr_length_; }
+ intptr_t exit_code() { return exit_code_; }
+
+ private:
+ uint8_t* stdout_data_;
+ intptr_t stdout_length_;
+ uint8_t* stderr_data_;
+ intptr_t stderr_length_;
+ intptr_t exit_code_;
+
+ DISALLOW_ALLOCATION();
+};
+
+
class Process {
public:
// Start a new process providing access to stdin, stdout, stderr and
@@ -30,6 +65,13 @@ class Process {
intptr_t* exit_handler,
char** os_error_message);
+ static bool Wait(intptr_t id,
+ intptr_t in,
+ intptr_t out,
+ intptr_t err,
+ intptr_t exit_handler,
+ ProcessResult* result);
+
// Kill a process with a given pid.
static bool Kill(intptr_t id, int signal);

Powered by Google App Engine
This is Rietveld 408576698