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

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: 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 | no next file » | 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..4d1b7d390692fd1537962d92e54e7f98e193cef4 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("sh", ["-c", 'command -v "\$installed"'],
kevmoo 2016/07/14 21:22:13 ...or just add 'runInShell: true' ?
nweiz 2016/07/14 22:06:56 Haha good idea!
+ environment: {"installed": installed});
if (result.exitCode == 0) return;
var binDir = _binStubDir;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698