From 9ecd9ebb4979352f93e071a4b74686fe10c3b060 Mon Sep 17 00:00:00 2001 From: Marco Cesarato Date: Thu, 15 Apr 2021 09:28:47 +0200 Subject: [PATCH] fix: add git command exists check --- src/DefaultCommand.php | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/DefaultCommand.php b/src/DefaultCommand.php index 9205276..40f480d 100644 --- a/src/DefaultCommand.php +++ b/src/DefaultCommand.php @@ -2,6 +2,7 @@ namespace ConventionalChangelog; +use ConventionalChangelog\Helper\ShellCommand; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; @@ -86,6 +87,12 @@ protected function execute(InputInterface $input, OutputInterface $output) { $outputStyle = new SymfonyStyle($input, $output); + if (!ShellCommand::exists('git')) { + $outputStyle->error('It looks like Git is not installed on your system. Please check how install it from https://git-scm.com before run this command.'); + + return 1; //Command::FAILURE; + } + // Retrieve configuration settings $config = $input->getOption('config'); if (!empty($config) && is_file($config)) {