Skip to content

Commit 528ee61

Browse files
authored
Update src/ScaffoldPackageCommand.php
1 parent ab250d7 commit 528ee61

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/ScaffoldPackageCommand.php

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,17 +340,19 @@ public function package_readme( $args, $assoc_args ) {
340340
* @var array{argv: array<string,string>} $GLOBALS
341341
*/
342342
$orig_argv = $GLOBALS['argv'];
343+
$cwd = getcwd();
344+
if ( false === $cwd ) {
345+
WP_CLI::error( 'Could not determine current working directory.' );
346+
}
343347
foreach ( $GLOBALS['argv'] as &$arg ) {
344348
if ( 0 === strpos( $arg, '--require=' ) ) {
345349
$req_path = substr( $arg, 10 );
346350
if ( ! \WP_CLI\Utils\is_path_absolute( $req_path ) ) {
347-
$arg = '--require=' . getcwd() . '/' . $req_path;
351+
$arg = '--require=' . $cwd . '/' . $req_path;
348352
}
349353
}
350354
}
351355
unset( $arg );
352-
353-
$cwd = (string) getcwd();
354356
chdir( $package_dir );
355357

356358
$cmd_dump = WP_CLI::runcommand(

0 commit comments

Comments
 (0)