Skip to content

Commit d180ea7

Browse files
authored
Merge pull request #21 from wp-cli/conditional-path
Only attempt to build relative path when inside of Phar
2 parents 6ec2432 + 9523b54 commit d180ea7

File tree

1 file changed

+3
-6
lines changed

1 file changed

+3
-6
lines changed

src/Server_Command.php

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,13 +76,10 @@ function __invoke( $_, $assoc_args ) {
7676
}
7777

7878
// Get the path to the router file
79-
$router_path = WP_CLI_ROOT . '/vendor/wp-cli/server-command/router.php';
79+
$command_root = WP_CLI\Utils\phar_safe_path( dirname( __DIR__ ) );
80+
$router_path = $command_root . '/router.php';
8081
if ( ! file_exists( $router_path ) ) {
81-
// server command must've been built with vendor/wp-cli/wp-cli
82-
$router_path = WP_CLI_ROOT . '/../../../router.php';
83-
if ( ! file_exists( $router_path ) ) {
84-
WP_CLI::error( "Couldn't find router.php" );
85-
}
82+
WP_CLI::error( "Couldn't find router.php" );
8683
}
8784
$cmd = \WP_CLI\Utils\esc_cmd( '%s -S %s -t %s -c %s %s',
8885
WP_CLI::get_php_binary(),

0 commit comments

Comments
 (0)