Skip to content

Commit 8655f8a

Browse files
committed
Use curl.exe
1 parent 04fd1a2 commit 8655f8a

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

src/Context/FeatureContext.php

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,15 @@ public static function get_bin_path(): ?string {
416416
return $bin_path;
417417
}
418418

419+
/**
420+
* Whether the current OS is Windows.
421+
*
422+
* @return bool
423+
*/
424+
static private function is_windows(): bool {
425+
return strtoupper(substr(PHP_OS, 0, 3)) === 'WIN';
426+
}
427+
419428
/**
420429
* Get the environment variables required for launched `wp` processes.
421430
*
@@ -565,9 +574,11 @@ private static function download_sqlite_plugin( $dir ): void {
565574
mkdir( $dir );
566575
}
567576

577+
$curl = self::is_windows() ? 'curl.exe' : 'curl';
578+
568579
Process::create(
569580
Utils\esc_cmd(
570-
'curl -sSfL %1$s > %2$s',
581+
"$curl -sSfL %1\$s > %2\$s",
571582
$download_url,
572583
$download_location
573584
)
@@ -1078,9 +1089,11 @@ public function download_phar( $version = 'same' ): void {
10781089
. uniqid( 'wp-cli-download-', true )
10791090
. '.phar';
10801091

1092+
$curl = self::is_windows() ? 'curl.exe' : 'curl';
1093+
10811094
Process::create(
10821095
Utils\esc_cmd(
1083-
'curl -sSfL %1$s > %2$s && chmod +x %2$s',
1096+
"$curl -sSfL %1\$s > %2\$s && chmod +x %2\$s",
10841097
$download_url,
10851098
$this->variables['PHAR_PATH']
10861099
)

0 commit comments

Comments
 (0)