Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用 curl下载出现错误时,打印错误信息 #887

Merged
merged 1 commit into from
Dec 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion sapi/download-box/download-box-get-archive-from-server.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ done

URL="${DOMAIN}/all-deps.zip"

test -f all-deps.zip || curl -Lo all-deps.zip ${URL}
test -f all-deps.zip || curl -fSLo all-deps.zip ${URL}

# hash 签名
HASH=$(sha256sum all-deps.zip | awk '{print $1}')
Expand Down
2 changes: 1 addition & 1 deletion sapi/scripts/download-php-src-archive.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
$download_dir = dirname($php_archive_file);

# 下载 PHP 源码
$download_cmd = "curl -L https://github.com/php/php-src/archive/refs/tags/php-{$php_version_tag}.tar.gz -o {$php_archive_file}";
$download_cmd = "curl -fSL https://github.com/php/php-src/archive/refs/tags/php-{$php_version_tag}.tar.gz -o {$php_archive_file}";
echo $download_cmd . PHP_EOL;
if (!file_exists($php_archive_file)) {
`test -d {$download_dir} || mkdir -p {$download_dir}`;
Expand Down
6 changes: 3 additions & 3 deletions sapi/scripts/generate-artifact-hash.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ UNIX_DOWNLOAD_SWOOLE_CLIE_RUNTIME() {

APP_DOWNLOAD_URL="https://github.com/swoole/swoole-cli/releases/download/${VERSION}/${APP_NAME}-${APP_VERSION}-${OS}-${ARCH}.tar.xz"
APP_RUNTIME="${APP_NAME}-${APP_VERSION}-${OS}-${ARCH}"
test -f ${APP_RUNTIME}.tar.xz || curl -LSo ${APP_RUNTIME}.tar.xz ${APP_DOWNLOAD_URL}
test -f ${APP_RUNTIME}.tar.xz || curl -fSLo ${APP_RUNTIME}.tar.xz ${APP_DOWNLOAD_URL}

}

Expand All @@ -112,8 +112,8 @@ ARCH="x64"
APP_DOWNLOAD_URL="https://github.com/swoole/swoole-cli/releases/download/${VERSION}/${APP_NAME}-${APP_VERSION}-cygwin-${ARCH}.zip"

APP_RUNTIME="${APP_NAME}-${APP_VERSION}-cygwin-${ARCH}"
test -f ${APP_RUNTIME}.zip || curl -LSo ${APP_RUNTIME}.zip ${APP_DOWNLOAD_URL}
test -f all-deps.zip || curl -LSo all-deps.zip https://github.com/swoole/swoole-cli/releases/download/${VERSION}/all-deps.zip
test -f ${APP_RUNTIME}.zip || curl -fSLo ${APP_RUNTIME}.zip ${APP_DOWNLOAD_URL}
test -f all-deps.zip || curl -fSLo all-deps.zip https://github.com/swoole/swoole-cli/releases/download/${VERSION}/all-deps.zip

ls -p | grep -v '/$' | xargs sha256sum

Expand Down
4 changes: 2 additions & 2 deletions sapi/src/Preprocessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,7 @@ protected function downloadFile(string $url, string $file, ?object $project = nu
if ($this->getInputOption('with-downloader') === 'wget') {
$cmd = "wget {$url} -O {$file} -t {$retry_number} --wait={$wait_retry} -T {$connect_timeout} ";
} else {
$cmd = "curl --connect-timeout {$connect_timeout} --retry {$retry_number} --retry-delay {$wait_retry} -Lo '{$file}' '{$url}' ";
$cmd = "curl --connect-timeout {$connect_timeout} --retry {$retry_number} --retry-delay {$wait_retry} -fSLo '{$file}' '{$url}' ";
}
echo $cmd;
echo PHP_EOL;
Expand Down Expand Up @@ -786,7 +786,7 @@ public function execute(): void
}

$this->generateFile(__DIR__ . '/template/make.php', $this->rootDir . '/make.sh');
shell_exec('chmod a+x '.$this->rootDir . '/make.sh');
shell_exec('chmod a+x ' . $this->rootDir . '/make.sh');
$this->mkdirIfNotExists($this->rootDir . '/bin');
$this->generateFile(__DIR__ . '/template/license.php', $this->rootDir . '/bin/LICENSE');
$this->generateFile(__DIR__ . '/template/credits.php', $this->rootDir . '/bin/credits.html');
Expand Down
9 changes: 4 additions & 5 deletions setup-php-runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ case $ARCH in
'x86_64')
ARCH="x64"
;;
'aarch64' | 'arm64' )
'aarch64' | 'arm64')
ARCH="arm64"
;;
*)
Expand Down Expand Up @@ -99,10 +99,10 @@ china)

esac

test -f composer.phar || curl -LSo composer.phar ${COMPOSER_DOWNLOAD_URL}
test -f composer.phar || curl -fSLo composer.phar ${COMPOSER_DOWNLOAD_URL}
chmod a+x composer.phar

test -f cacert.pem || curl -LSo cacert.pem ${CACERT_DOWNLOAD_URL}
test -f cacert.pem || curl -fSLo cacert.pem ${CACERT_DOWNLOAD_URL}

APP_RUNTIME="${APP_NAME}-${APP_VERSION}-${OS}-${ARCH}"

Expand All @@ -115,7 +115,7 @@ if [ $OS = 'windows' ]; then
exit 0
}
else
test -f ${APP_RUNTIME}.tar.xz || curl -LSo ${APP_RUNTIME}.tar.xz ${APP_DOWNLOAD_URL}
test -f ${APP_RUNTIME}.tar.xz || curl -fSLo ${APP_RUNTIME}.tar.xz ${APP_DOWNLOAD_URL}
test -f ${APP_RUNTIME}.tar || xz -d -k ${APP_RUNTIME}.tar.xz
test -f swoole-cli && rm -f swoole-cli
tar -xvf ${APP_RUNTIME}.tar
Expand Down Expand Up @@ -166,4 +166,3 @@ test $OS="macos" && echo "sudo xattr -d com.apple.quarantine ${__PROJECT__}/bin/
echo " "
export PATH="${__PROJECT__}/bin/runtime:$PATH"
php -v

8 changes: 4 additions & 4 deletions setup-swoole-cli-runtime.sh
Original file line number Diff line number Diff line change
Expand Up @@ -125,24 +125,24 @@ china)

esac

test -f composer.phar || curl -LSo composer.phar ${COMPOSER_DOWNLOAD_URL}
test -f composer.phar || curl -fSLo composer.phar ${COMPOSER_DOWNLOAD_URL}
chmod a+x composer.phar

test -f cacert.pem || curl -LSo cacert.pem ${CACERT_DOWNLOAD_URL}
test -f cacert.pem || curl -fSLo cacert.pem ${CACERT_DOWNLOAD_URL}

APP_RUNTIME="${APP_NAME}-${APP_VERSION}-${OS}-${ARCH}"

if [ $OS = 'windows' ]; then
{
APP_RUNTIME="${APP_NAME}-${APP_VERSION}-cygwin-${ARCH}"
test -f ${APP_RUNTIME}.zip || curl -LSo ${APP_RUNTIME}.zip ${APP_DOWNLOAD_URL}
test -f ${APP_RUNTIME}.zip || curl -fSLo ${APP_RUNTIME}.zip ${APP_DOWNLOAD_URL}
test -d ${APP_RUNTIME} && rm -rf ${APP_RUNTIME}
unzip "${APP_RUNTIME}.zip"
echo
exit 0
}
else
test -f ${APP_RUNTIME}.tar.xz || curl -LSo ${APP_RUNTIME}.tar.xz ${APP_DOWNLOAD_URL}
test -f ${APP_RUNTIME}.tar.xz || curl -fSLo ${APP_RUNTIME}.tar.xz ${APP_DOWNLOAD_URL}
test -f ${APP_RUNTIME}.tar || xz -d -k ${APP_RUNTIME}.tar.xz
test -f swoole-cli && rm -f swoole-cli
tar -xvf ${APP_RUNTIME}.tar
Expand Down
Loading