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 part of testrunner; | 5 part of testrunner; |
6 | 6 |
7 /** Create a file [fileName] and populate it with [contents]. */ | 7 /** Create a file [fileName] and populate it with [contents]. */ |
8 void writeFile(String fileName, String contents) { | 8 void writeFile(String fileName, String contents) { |
9 var file = new File(fileName); | 9 var file = new File(fileName); |
10 file.writeAsStringSync(contents); | 10 file.writeAsStringSync(contents); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
86 } | 86 } |
87 return files; | 87 return files; |
88 } | 88 } |
89 | 89 |
90 /** | 90 /** |
91 * Get the directory that testrunner lives in; we need it to import | 91 * Get the directory that testrunner lives in; we need it to import |
92 * support files into the generated scripts. | 92 * support files into the generated scripts. |
93 */ | 93 */ |
94 | 94 |
95 String get runnerDirectory { | 95 String get runnerDirectory { |
96 var libDirectory = makePathAbsolute(new Options().script); | 96 var libDirectory = makePathAbsolute(Platform.script); |
Anders Johnsen
2013/06/20 15:57:43
Isn't this file using an older version of Dart?
| |
97 return libDirectory.substring(0, | 97 return libDirectory.substring(0, |
98 libDirectory.lastIndexOf(Platform.pathSeparator)); | 98 libDirectory.lastIndexOf(Platform.pathSeparator)); |
99 } | 99 } |
100 | 100 |
101 /* | 101 /* |
102 * Run an external process [cmd] with command line arguments [args]. | 102 * Run an external process [cmd] with command line arguments [args]. |
103 * Returns a [Future] for when the process terminates. | 103 * Returns a [Future] for when the process terminates. |
104 */ | 104 */ |
105 Future _processHelper(String command, List<String> args, | 105 Future _processHelper(String command, List<String> args, |
106 {String workingDir}) { | 106 {String workingDir}) { |
107 var options = null; | 107 var options = null; |
108 if (workingDir != null) { | 108 if (workingDir != null) { |
109 options = new ProcessOptions(); | 109 options = new ProcessOptions(); |
110 options.workingDirectory = workingDir; | 110 options.workingDirectory = workingDir; |
111 } | 111 } |
112 return Process.run(command, args, options) | 112 return Process.run(command, args, options) |
113 .then((result) => result.exitCode) | 113 .then((result) => result.exitCode) |
114 .catchError((e) { | 114 .catchError((e) { |
115 print("$command ${args.join(' ')}: ${e.toString()}"); | 115 print("$command ${args.join(' ')}: ${e.toString()}"); |
116 }); | 116 }); |
117 } | 117 } |
118 | 118 |
OLD | NEW |