OLD | NEW |
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 #library("drt_updater"); | 5 #library("drt_updater"); |
6 | 6 |
7 #import("dart:io"); | 7 #import("dart:io"); |
8 #import("dart:builtin"); | 8 #import("dart:builtin"); |
9 | 9 |
10 class _DartiumUpdater { | 10 class _DartiumUpdater { |
(...skipping 16 matching lines...) Expand all Loading... |
27 onUpdated = [() {updated = true;} ]; | 27 onUpdated = [() {updated = true;} ]; |
28 _updatingProcess = new Process.start('python', _getUpdateCommand); | 28 _updatingProcess = new Process.start('python', _getUpdateCommand); |
29 _updatingProcess.onExit = _onUpdatedHandler; | 29 _updatingProcess.onExit = _onUpdatedHandler; |
30 _updatingProcess.onError = (error) { | 30 _updatingProcess.onError = (error) { |
31 print("Error starting $script process: $error"); | 31 print("Error starting $script process: $error"); |
32 _onUpdatedHandler(-1); // Continue anyway. | 32 _onUpdatedHandler(-1); // Continue anyway. |
33 }; | 33 }; |
34 } | 34 } |
35 } | 35 } |
36 | 36 |
37 String get _getUpdateCommand() { | 37 List<String> get _getUpdateCommand() { |
38 String scriptPath = new Options().script.replaceAll('\\', '/'); | 38 String scriptPath = new Options().script.replaceAll('\\', '/'); |
39 String toolsDir = scriptPath.substring(0, scriptPath.lastIndexOf('/')); | 39 String toolsDir = scriptPath.substring(0, scriptPath.lastIndexOf('/')); |
40 List<String> command = ['$toolsDir/$script']; | 40 List<String> command = ['$toolsDir/$script']; |
41 if (null !== option) { | 41 if (null !== option) { |
42 command.add(option); | 42 command.add(option); |
43 } | 43 } |
44 return command; | 44 return command; |
45 } | 45 } |
46 | 46 |
47 void _onUpdatedHandler(int exit_code) { | 47 void _onUpdatedHandler(int exit_code) { |
(...skipping 15 matching lines...) Expand all Loading... |
63 } else if (runtime == 'dartium') { | 63 } else if (runtime == 'dartium') { |
64 if (_dartiumUpdater === null) { | 64 if (_dartiumUpdater === null) { |
65 _dartiumUpdater = new _DartiumUpdater('Dartium Chrome', 'get_drt.py', | 65 _dartiumUpdater = new _DartiumUpdater('Dartium Chrome', 'get_drt.py', |
66 '--dartium'); | 66 '--dartium'); |
67 } | 67 } |
68 return _dartiumUpdater; | 68 return _dartiumUpdater; |
69 } else { | 69 } else { |
70 return null; | 70 return null; |
71 } | 71 } |
72 } | 72 } |
OLD | NEW |