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

Side by Side Diff: lib/src/executable.dart

Issue 1217923002: Fix a "pub run" bug. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Created 5 years, 5 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
« no previous file with comments | « no previous file | test/run/loads_package_imports_in_a_dependency_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) 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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 103
104 if (executableUrl == null) { 104 if (executableUrl == null) {
105 var message = "Could not find ${log.bold(executable)}"; 105 var message = "Could not find ${log.bold(executable)}";
106 if (package != entrypoint.root.name) { 106 if (package != entrypoint.root.name) {
107 message += " in package ${log.bold(package)}"; 107 message += " in package ${log.bold(package)}";
108 } 108 }
109 log.error("$message."); 109 log.error("$message.");
110 return exit_codes.NO_INPUT; 110 return exit_codes.NO_INPUT;
111 } 111 }
112 112
113 // If we're running an executable directly from the filesystem, make sure that
114 // it knows where to load the packages. If it's a dependency's executable, for
115 // example, it may not have the right packages directory itself.
116 if (executableUrl.scheme == 'file') {
117 // TODO(nweiz): use a .packages file once sdk#23369 is fixed.
118 vmArgs.add('--package-root=${p.toUri(entrypoint.packagesDir)}');
119 }
120
113 vmArgs.add(executableUrl.toString()); 121 vmArgs.add(executableUrl.toString());
114 vmArgs.addAll(args); 122 vmArgs.addAll(args);
115 123
116 var process = await Process.start(Platform.executable, vmArgs); 124 var process = await Process.start(Platform.executable, vmArgs);
117 125
118 _forwardSignals(process); 126 _forwardSignals(process);
119 127
120 // Note: we're not using process.std___.pipe(std___) here because 128 // Note: we're not using process.std___.pipe(std___) here because
121 // that prevents pub from also writing to the output streams. 129 // that prevents pub from also writing to the output streams.
122 process.stderr.listen(stderr.add); 130 process.stderr.listen(stderr.add);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 } 262 }
255 263
256 /// Runs the executable snapshot at [snapshotPath]. 264 /// Runs the executable snapshot at [snapshotPath].
257 Future<int> _runCachedExecutable(Entrypoint entrypoint, String snapshotPath, 265 Future<int> _runCachedExecutable(Entrypoint entrypoint, String snapshotPath,
258 List<String> args) { 266 List<String> args) {
259 return runSnapshot(snapshotPath, args, checked: true, recompile: () { 267 return runSnapshot(snapshotPath, args, checked: true, recompile: () {
260 log.fine("Precompiled executable is out of date."); 268 log.fine("Precompiled executable is out of date.");
261 return entrypoint.precompileExecutables(); 269 return entrypoint.precompileExecutables();
262 }); 270 });
263 } 271 }
OLDNEW
« no previous file with comments | « no previous file | test/run/loads_package_imports_in_a_dependency_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698