summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorDmitri Gopkalo <[email protected]>2019-08-09 01:06:07 +0300
committerDmitri Gopkalo <[email protected]>2019-08-09 11:22:40 +0300
commit79f7983f1a8f2e0c4743cfcecd8d14c3aa0a6c4d (patch)
tree98e9995e939ea2e32583d3c24aa7aa72d32119dc /bin
parentb512dd6ba4f8b809bba797ed9260b78f2ffe6822 (diff)
- remembered about windows compatibility :) and move solution from shell awk to Perl based regex.
Diffstat (limited to 'bin')
-rwxr-xr-xbin/rr11
1 files changed, 8 insertions, 3 deletions
diff --git a/bin/rr b/bin/rr
index d0363601..b62a9851 100755
--- a/bin/rr
+++ b/bin/rr
@@ -198,17 +198,22 @@ class RRHelper
if (is_file($finalFile)) {
$version = RRHelper::getVersion();
- $previousVersion = shell_exec($finalFile . ' | awk \'/\'Version:\'/ { gsub(/[^[:digit:]\.]+/, "", $2); printf $2}\'');
+ $previousVersion =
+ preg_match('#Version:.+(\d+\.\d+\.\d+)#', (string)shell_exec($finalFile), $mathes) ?
+ $mathes[1] : "";
$output->writeln('<error>RoadRunner binary file already exists!</error>');
$helper = $this->getHelper('question');
if (version_compare($previousVersion, $version) === 0) {
$output->writeln(sprintf('<info>Current version: %s</info>', $previousVersion));
- $question = new ConfirmationQuestion(sprintf('Skip update to the same version: %s ? [Y/n]', $version));
+ $question = new ConfirmationQuestion(
+ sprintf('Skip update to the same version: %s ? [Y/n]', $version)
+ );
if ($helper->ask($input, $output, $question)) {
return;
}
} else {
- if (!$helper->ask($input, $output, new ConfirmationQuestion('Do you want overwrite it? [Y/n] '))) {
+ $question = new ConfirmationQuestion('Do you want overwrite it? [Y/n]');
+ if (!$helper->ask($input, $output, $question)) {
return;
}
}