| Index: utils/testrunner/pipeline_utils.dart
|
| ===================================================================
|
| --- utils/testrunner/pipeline_utils.dart (revision 13499)
|
| +++ utils/testrunner/pipeline_utils.dart (working copy)
|
| @@ -58,14 +58,12 @@
|
| */
|
| Future _processHelper(String command, List<String> args,
|
| [int timeout = 300, int procId = 0]) {
|
| - var completer = null;
|
| + var completer = new Completer();
|
| log.add('Running $command ${Strings.join(args, " ")}');
|
| var timer = null;
|
| var stdoutHandler, stderrHandler;
|
| var process = Process.start(command, args);
|
| - if (procId == 0) {
|
| - completer = new Completer();
|
| - } else {
|
| + if (procId != 0) {
|
| _procs[procId] = process;
|
| }
|
| process.onStart = () {
|
| @@ -93,7 +91,7 @@
|
| _pipeStream(process.stdout, stdout);
|
| _pipeStream(process.stderr, stderr);
|
|
|
| - return (completer == null) ? null : completer.future;
|
| + return completer.future;
|
| }
|
|
|
| void _pipeStream(InputStream stream, List<String> destination) {
|
| @@ -128,17 +126,26 @@
|
| */
|
| int startProcess(String command, List<String> args) {
|
| int id = _procId++;
|
| - _processHelper(command, args, 3000, id);
|
| + _processHelper(command, args, 3000, id).then((e) {
|
| + _procs.remove(id);
|
| + });
|
| return id;
|
| }
|
|
|
| +/** Checks if a process is still running. */
|
| +bool isProcessRunning(int id) {
|
| + return _procs.containsKey(id);
|
| +}
|
| +
|
| /**
|
| * Stop a process previously started with [startProcess] or [runCommand],
|
| * given the id string.
|
| */
|
| void stopProcess(int id) {
|
| - Process p = _procs.remove(id);
|
| - p.kill();
|
| + if (_procs.containsKey(id)) {
|
| + Process p = _procs.remove(id);
|
| + p.kill();
|
| + }
|
| }
|
|
|
| /** Delete a file named [fname] if it exists. */
|
|
|