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

Unified Diff: lib/src/global_packages.dart

Issue 2148413002: Use the command builtin rather than which. (Closed) Base URL: git@github.com:dart-lang/pub.git@master
Patch Set: Use runInShell. Created 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/src/io.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/global_packages.dart
diff --git a/lib/src/global_packages.dart b/lib/src/global_packages.dart
index 86ed14792d81b209ea5a77845a7f51b119ca6eda..06217a9f3b510f6ae731655bd1e4e736d13a15fc 100644
--- a/lib/src/global_packages.dart
+++ b/lib/src/global_packages.dart
@@ -770,7 +770,11 @@ pub global run ${package.name}:$script "\$@"
'A web search for "configure windows path" will show you how.');
} else {
// See if the shell can find one of the binstubs.
- var result = runProcessSync("which", [installed]);
+ //
+ // The "command" builtin is more reliable than the "which" executable. See
+ // http://unix.stackexchange.com/questions/85249/why-not-use-which-what-to-use-then
+ var result = runProcessSync("command", ["-v", installed],
+ runInShell: true);
if (result.exitCode == 0) return;
var binDir = _binStubDir;
« no previous file with comments | « no previous file | lib/src/io.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698