Index: lib/io/process.dart |
diff --git a/runtime/bin/process.dart b/lib/io/process.dart |
similarity index 90% |
rename from runtime/bin/process.dart |
rename to lib/io/process.dart |
index 9d5206c94f1c2231011cf17801301df7fb473603..3c514f77bc9895ff654c154a931a99a752af16e7 100644 |
--- a/runtime/bin/process.dart |
+++ b/lib/io/process.dart |
@@ -2,19 +2,23 @@ |
// for details. All rights reserved. Use of this source code is governed by a |
// BSD-style license that can be found in the LICENSE file. |
+class _ProcessUtils { |
Søren Gjesse
2012/10/30 09:28:32
TODO?
Mads Ager (google)
2012/10/30 11:12:40
Done.
|
+ external static _exit(int status); |
+} |
+ |
/** Exit the Dart VM process with the given [status] code. */ |
void exit(int status) { |
if (status is !int) { |
throw new ArgumentError("int status expected"); |
} |
- _exit(status); |
+ _ProcessUtils._exit(status); |
} |
/** |
* [Process] is used to start new processes using the static |
* [start] and [run] methods. |
*/ |
-class Process { |
+abstract class Process { |
/** |
* Starts a process running the [executable] with the specified |
* [arguments]. Returns a [:Future<Process>:] that completes with a |
@@ -31,11 +35,9 @@ class Process { |
* does not read all data on the streams the underlying system |
* resources will not be freed since there is still pending data. |
*/ |
- static Future<Process> start(String executable, |
- List<String> arguments, |
- [ProcessOptions options]) { |
- return _Process.start(executable, arguments, options); |
- } |
+ external static Future<Process> start(String executable, |
+ List<String> arguments, |
+ [ProcessOptions options]); |
/** |
* Starts a process and runs it non-interactively to completion. The |
@@ -48,11 +50,9 @@ class Process { |
* result of running the process, i.e., exit code, standard out and |
* standard in. |
*/ |
- static Future<ProcessResult> run(String executable, |
- List<String> arguments, |
- [ProcessOptions options]) { |
- return _Process.run(executable, arguments, options); |
- } |
+ external static Future<ProcessResult> run(String executable, |
+ List<String> arguments, |
+ [ProcessOptions options]); |
/** |
* Returns an input stream of the process stdout. |
@@ -60,7 +60,7 @@ class Process { |
* Throws an [UnsupportedError] if the process is |
* non-interactive. |
*/ |
- abstract InputStream get stdout; |
+ InputStream get stdout; |
/** |
* Returns an input stream of the process stderr. |
@@ -68,7 +68,7 @@ class Process { |
* Throws an [UnsupportedError] if the process is |
* non-interactive. |
*/ |
- abstract InputStream get stderr; |
+ InputStream get stderr; |
/** |
* Returns an output stream to the process stdin. |
@@ -76,7 +76,7 @@ class Process { |
* Throws an [UnsupportedError] if the process is |
* non-interactive. |
*/ |
- abstract OutputStream get stdin; |
+ OutputStream get stdin; |
/** |
* Sets an exit handler which gets invoked when the process |
@@ -85,7 +85,7 @@ class Process { |
* Throws an [UnsupportedError] if the process is |
* non-interactive. |
*/ |
- abstract void set onExit(void callback(int exitCode)); |
+ void set onExit(void callback(int exitCode)); |
/** |
* On Windows, [kill] kills the process, ignoring the [signal] |
@@ -100,7 +100,7 @@ class Process { |
* a [:false:] return value from kill means that the process is |
* already dead. |
*/ |
- abstract bool kill([ProcessSignal signal = ProcessSignal.SIGTERM]); |
+ bool kill([ProcessSignal signal = ProcessSignal.SIGTERM]); |
} |