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

Unified Diff: lib/src/executable.dart

Issue 1292003005: Don't crash for pre-1.12 global packages. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Created 5 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/src/global_packages.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/executable.dart
diff --git a/lib/src/executable.dart b/lib/src/executable.dart
index 749277ff148e5121d06ded95b81147381aaa78cd..65b276ee4cdbf5b5c430aa4d527d54fd687ca7a9 100644
--- a/lib/src/executable.dart
+++ b/lib/src/executable.dart
@@ -111,7 +111,12 @@ Future<int> runExecutable(Entrypoint entrypoint, String package,
// If we're running an executable directly from the filesystem, make sure that
// it knows where to load the packages. If it's a dependency's executable, for
// example, it may not have the right packages directory itself.
- if (executableUrl.scheme == 'file' || executableUrl.scheme == '') {
+ //
+ // We don't do this for global executables because older ones may not have a
+ // `.packages` file generated. If they do, the VM's logic will find it
+ // automatically.
+ if (!isGlobal &&
+ (executableUrl.scheme == 'file' || executableUrl.scheme == '')) {
// We use an absolute path here not because the VM insists but because it's
// helpful for the subprocess to be able to spawn Dart with
// Platform.executableArguments and have that work regardless of the working
« no previous file with comments | « no previous file | lib/src/global_packages.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698