| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 pub.executable; | 5 library pub.executable; |
| 6 | 6 |
| 7 import 'dart:async'; | 7 import 'dart:async'; |
| 8 import 'dart:io'; | 8 import 'dart:io'; |
| 9 | 9 |
| 10 import 'package:barback/barback.dart'; | 10 import 'package:barback/barback.dart'; |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 var process = await Process.start(Platform.executable, vmArgs); | 134 var process = await Process.start(Platform.executable, vmArgs); |
| 135 | 135 |
| 136 _forwardSignals(process); | 136 _forwardSignals(process); |
| 137 | 137 |
| 138 // Note: we're not using process.std___.pipe(std___) here because | 138 // Note: we're not using process.std___.pipe(std___) here because |
| 139 // that prevents pub from also writing to the output streams. | 139 // that prevents pub from also writing to the output streams. |
| 140 process.stderr.listen(stderr.add); | 140 process.stderr.listen(stderr.add); |
| 141 process.stdout.listen(stdout.add); | 141 process.stdout.listen(stdout.add); |
| 142 stdin.listen(process.stdin.add); | 142 stdin.listen(process.stdin.add); |
| 143 | 143 |
| 144 return process.exitCode; | 144 // Work around dart-lang/sdk#25348. |
| 145 process.stdin.done.catchError((_) {}); |
| 146 |
| 147 return await process.exitCode; |
| 145 } | 148 } |
| 146 | 149 |
| 147 /// Returns the URL the VM should use to load the executable at [path]. | 150 /// Returns the URL the VM should use to load the executable at [path]. |
| 148 /// | 151 /// |
| 149 /// [path] must be relative to the root of [package]. If [path] doesn't exist, | 152 /// [path] must be relative to the root of [package]. If [path] doesn't exist, |
| 150 /// returns `null`. | 153 /// returns `null`. |
| 151 Future<Uri> _executableUrl(Entrypoint entrypoint, String package, String path, | 154 Future<Uri> _executableUrl(Entrypoint entrypoint, String package, String path, |
| 152 {bool isGlobal: false, BarbackMode mode}) async { | 155 {bool isGlobal: false, BarbackMode mode}) async { |
| 153 assert(p.isRelative(path)); | 156 assert(p.isRelative(path)); |
| 154 | 157 |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 Future<int> _runCachedExecutable(Entrypoint entrypoint, String snapshotPath, | 287 Future<int> _runCachedExecutable(Entrypoint entrypoint, String snapshotPath, |
| 285 List<String> args, {bool checked: false}) { | 288 List<String> args, {bool checked: false}) { |
| 286 return runSnapshot(snapshotPath, args, | 289 return runSnapshot(snapshotPath, args, |
| 287 packagesFile: entrypoint.packagesFile, | 290 packagesFile: entrypoint.packagesFile, |
| 288 checked: checked, | 291 checked: checked, |
| 289 recompile: () { | 292 recompile: () { |
| 290 log.fine("Precompiled executable is out of date."); | 293 log.fine("Precompiled executable is out of date."); |
| 291 return entrypoint.precompileExecutables(); | 294 return entrypoint.precompileExecutables(); |
| 292 }); | 295 }); |
| 293 } | 296 } |
| OLD | NEW |