Skip to content
Permalink
Browse files

Fix setting of current_dir with 'root' command parameter (#2001)

  • Loading branch information...
mitelg authored and muglug committed Aug 11, 2019
1 parent 6397421 commit 5722512180e2ca741b86de76c41cec45b85be904
Showing with 14 additions and 16 deletions.
  1. +14 −16 src/psalm.php
@@ -180,6 +180,20 @@ function ($arg) use ($valid_long_options, $valid_short_options) {
$current_dir = (string)getcwd() . DIRECTORY_SEPARATOR;
if (isset($options['r']) && is_string($options['r'])) {
$root_path = realpath($options['r']);
if (!$root_path) {
fwrite(
STDERR,
'Could not locate root directory ' . $current_dir . DIRECTORY_SEPARATOR . $options['r'] . PHP_EOL
);
exit(1);
}
$current_dir = $root_path . DIRECTORY_SEPARATOR;
}
$path_to_config = get_path_to_config($options);
$vendor_dir = getVendorDir($current_dir);
@@ -257,22 +271,6 @@ function ($arg) {
chdir($current_dir);
}
if (isset($options['r']) && is_string($options['r'])) {
$root_path = realpath($options['r']);
if (!$root_path) {
fwrite(
STDERR,
'Could not locate root directory ' . $current_dir . DIRECTORY_SEPARATOR . $options['r'] . PHP_EOL
);
exit(1);
}
$current_dir = $root_path . DIRECTORY_SEPARATOR;
}
$threads = isset($options['threads']) ? (int)$options['threads'] : 1;
if ($threads === 1

0 comments on commit 5722512

Please sign in to comment.
You can’t perform that action at this time.