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

Side by Side Diff: utils/testrunner/pipeline_utils.dart

Issue 12213092: Rework Timer interface. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Address comments. Created 7 years, 10 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « utils/pub/utils.dart ('k') | utils/tests/pub/version_solver_test.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of pipeline; 5 part of pipeline;
6 6
7 List stdout, stderr, log; 7 List stdout, stderr, log;
8 var replyPort; 8 var replyPort;
9 int _procId = 1; 9 int _procId = 1;
10 Map _procs = {}; 10 Map _procs = {};
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 Future _processHelper(String command, List<String> args, 61 Future _processHelper(String command, List<String> args,
62 [int timeout = 300, int procId = 0, Function outputMonitor]) { 62 [int timeout = 300, int procId = 0, Function outputMonitor]) {
63 var completer = procId == 0 ? new Completer() : null; 63 var completer = procId == 0 ? new Completer() : null;
64 log.add('Running $command ${Strings.join(args, " ")}'); 64 log.add('Running $command ${Strings.join(args, " ")}');
65 var timer = null; 65 var timer = null;
66 var stdoutHandler, stderrHandler; 66 var stdoutHandler, stderrHandler;
67 var processFuture = Process.start(command, args); 67 var processFuture = Process.start(command, args);
68 processFuture.then((process) { 68 processFuture.then((process) {
69 _procs[procId] = process; 69 _procs[procId] = process;
70 70
71 timer = new Timer(1000 * timeout, (t) { 71 timer = new Timer(new Duration(seconds: timeout), () {
72 timer = null; 72 timer = null;
73 process.kill(); 73 process.kill();
74 }); 74 });
75 75
76 process.onExit = (exitCode) { 76 process.onExit = (exitCode) {
77 if (timer != null) { 77 if (timer != null) {
78 timer.cancel(); 78 timer.cancel();
79 } 79 }
80 process.close(); 80 process.close();
81 if (completer != null) { 81 if (completer != null) {
(...skipping 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 stderr = new List(); 179 stderr = new List();
180 log = new List(); 180 log = new List();
181 } 181 }
182 182
183 void completePipeline([exitCode = 0]) { 183 void completePipeline([exitCode = 0]) {
184 replyPort.send([stdout, stderr, log, exitCode]); 184 replyPort.send([stdout, stderr, log, exitCode]);
185 } 185 }
186 186
187 /** Utility function to log diagnostic messages. */ 187 /** Utility function to log diagnostic messages. */
188 void logMessage(msg) => log.add(msg); 188 void logMessage(msg) => log.add(msg);
OLDNEW
« no previous file with comments | « utils/pub/utils.dart ('k') | utils/tests/pub/version_solver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698