Index: sdk/lib/_internal/pub/lib/src/executable.dart |
diff --git a/sdk/lib/_internal/pub/lib/src/executable.dart b/sdk/lib/_internal/pub/lib/src/executable.dart |
index e7d1c10139b19ac18aa04a113cc0e4c332c72f4f..4a50612fa2bbe32b1f1dc3f0e4d094e5580b5e9c 100644 |
--- a/sdk/lib/_internal/pub/lib/src/executable.dart |
+++ b/sdk/lib/_internal/pub/lib/src/executable.dart |
@@ -30,14 +30,18 @@ import 'utils.dart'; |
/// |
/// Returns the exit code of the spawned app. |
Future<int> runExecutable(PubCommand command, Entrypoint entrypoint, |
- String package, String executable, Iterable<String> args) { |
+ String package, String executable, Iterable<String> args, |
+ {bool isGlobal: false}) { |
// If the command has a path separator, then it's a path relative to the |
// root of the package. Otherwise, it's implicitly understood to be in |
// "bin". |
var rootDir = "bin"; |
var parts = p.split(executable); |
if (parts.length > 1) { |
- if (package != entrypoint.root.name) { |
+ if (isGlobal) { |
+ command.usageError( |
+ 'Cannot run an executable in a subdirectory of a global package.'); |
+ } else if (package != entrypoint.root.name) { |
command.usageError( |
"Cannot run an executable in a subdirectory of a dependency."); |
} |