Ensure that a friendly error is printed whenever git can't be found.
[email protected]
BUG=19067
Review URL: https://codereview.chromium.org//308793016
git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge@36910 260f80e4-7a28-3924-810f-c04153c831b5
diff --git a/lib/src/git.dart b/lib/src/git.dart
index 510ca7e..d79a914 100644
--- a/lib/src/git.dart
+++ b/lib/src/git.dart
@@ -10,6 +10,7 @@
import 'io.dart';
import 'log.dart' as log;
+import 'utils.dart';
/// An exception thrown because a git command failed.
class GitException implements Exception {
@@ -41,6 +42,12 @@
Future<List<String>> run(List<String> args,
{String workingDir, Map<String, String> environment}) {
return _gitCommand.then((git) {
+ if (git == null) {
+ throw new ApplicationException(
+ "Cannot find a Git executable.\n"
+ "Please ensure Git is correctly installed.");
+ }
+
return runProcess(git, args, workingDir: workingDir,
environment: environment);
}).then((result) {