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

Unified Diff: sdk/lib/io/process.dart

Issue 890633002: Add an option for starting a detached process with stdio connected (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix bug Created 5 years, 11 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/process_patch.dart ('k') | tests/standalone/io/process_detached_script.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/io/process.dart
diff --git a/sdk/lib/io/process.dart b/sdk/lib/io/process.dart
index a977b319b6173dd8bfe70d0cf62bfb952217c7ad..ef6d8ab343d046ece7e2b8b7a406715ef89c0530 100644
--- a/sdk/lib/io/process.dart
+++ b/sdk/lib/io/process.dart
@@ -100,6 +100,18 @@ void sleep(Duration duration) {
int get pid => _ProcessUtils._pid(null);
/**
+ * Modes for running a new process.
+ */
+enum ProcessStartMode {
+ /// Normal child process.
+ NORMAL,
+ /// Detached child process.
+ DETACHED,
+ /// Detachad clild process with stdin, stdout and stderr connected.
Lasse Reichstein Nielsen 2015/01/30 12:11:37 clild -> child Connected to what?
Søren Gjesse 2015/02/02 13:56:44 Done.
+ DETACHED_WITH_STDIO
+}
+
+/**
* The means to execute a program.
*
* Use the static [start] and [run] methods to start a new process.
@@ -258,12 +270,24 @@ abstract class Process {
* stderr.addStream(process.stderr);
* });
*
- * If [detach] is `true` a detached process will be created. A
- * detached process has no connection to its parent, and can
- * keep running on its own when the parent dies. The only
+ * If [mode] is [ProcessStartMode.NORMAL] a normal child process
+ * will be started.
Lasse Reichstein Nielsen 2015/01/30 12:11:37 Explain what "normal" means, or rephrase as: If [
Søren Gjesse 2015/02/02 13:56:44 Done.
+ *
+ * If `mode` is [ProcessStartMode.DETACHED] a detached process will
+ * be created. A detached process has no connection to its parent,
+ * and can keep running on its own when the parent dies. The only
* information available from a detached process is its `pid`. There
- * is no connection to its `stdin`, `stdout` or `stderr` nor will its
- * exit code become available when it terminates.
+ * is no connection to its `stdin`, `stdout` or `stderr` nor will
Lasse Reichstein Nielsen 2015/01/30 12:11:37 comma before "nor"?
Søren Gjesse 2015/02/02 13:56:44 Done.
+ * its exit code become available when it terminates.
+ *
+ * If `mode` is [ProcessStartMode.DETACHED_WITH_STDIO] a detached
+ * process will be created where the `stdin`, `stdout` and `stderr`
+ * are connected. The creator can communication with the child. When
Lasse Reichstein Nielsen 2015/01/30 12:11:37 can communication with the child -> can communica
Søren Gjesse 2015/02/02 13:56:44 Done.
+ * these communication channels are closed the detached process will
Lasse Reichstein Nielsen 2015/01/30 12:11:37 Rewrite as: The detached process will keep running
Søren Gjesse 2015/02/02 13:56:44 Done.
+ * keep running. Its exit code will not become available when it
Lasse Reichstein Nielsen 2015/01/30 12:11:37 Its -> The process'
Søren Gjesse 2015/02/02 13:56:44 Done.
+ * terminated.
Lasse Reichstein Nielsen 2015/01/30 12:11:37 terminated -> terminates.
Søren Gjesse 2015/02/02 13:56:44 Done.
+ *
+ * The default value for `mode` is `ProcessStartMode.NORMAL`.
*/
external static Future<Process> start(
String executable,
@@ -272,7 +296,7 @@ abstract class Process {
Map<String, String> environment,
bool includeParentEnvironment: true,
bool runInShell: false,
- bool detach: false});
+ ProcessStartMode mode: ProcessStartMode.NORMAL});
/**
* Starts a process and runs it non-interactively to completion. The
« no previous file with comments | « runtime/bin/process_patch.dart ('k') | tests/standalone/io/process_detached_script.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698