Skip to content

Commit

Permalink
Merge pull request #21 from wp-cli/conditional-path
Browse files Browse the repository at this point in the history
Only attempt to build relative path when inside of Phar
  • Loading branch information
schlessera authored Apr 28, 2017
2 parents 6ec2432 + 9523b54 commit d180ea7
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions src/Server_Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,10 @@ function __invoke( $_, $assoc_args ) {
}

// Get the path to the router file
$router_path = WP_CLI_ROOT . '/vendor/wp-cli/server-command/router.php';
$command_root = WP_CLI\Utils\phar_safe_path( dirname( __DIR__ ) );
$router_path = $command_root . '/router.php';
if ( ! file_exists( $router_path ) ) {
// server command must've been built with vendor/wp-cli/wp-cli
$router_path = WP_CLI_ROOT . '/../../../router.php';
if ( ! file_exists( $router_path ) ) {
WP_CLI::error( "Couldn't find router.php" );
}
WP_CLI::error( "Couldn't find router.php" );
}
$cmd = \WP_CLI\Utils\esc_cmd( '%s -S %s -t %s -c %s %s',
WP_CLI::get_php_binary(),
Expand Down

0 comments on commit d180ea7

Please sign in to comment.