mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-14 04:15:35 +08:00
Use PatchException instead of ExecutionException for patchFile
This commit is contained in:
@@ -8,6 +8,7 @@ use SPC\builder\BuilderBase;
|
|||||||
use SPC\builder\linux\SystemUtil;
|
use SPC\builder\linux\SystemUtil;
|
||||||
use SPC\builder\unix\UnixBuilderBase;
|
use SPC\builder\unix\UnixBuilderBase;
|
||||||
use SPC\builder\windows\WindowsBuilder;
|
use SPC\builder\windows\WindowsBuilder;
|
||||||
|
use SPC\exception\ExecutionException;
|
||||||
use SPC\exception\FileSystemException;
|
use SPC\exception\FileSystemException;
|
||||||
use SPC\exception\PatchException;
|
use SPC\exception\PatchException;
|
||||||
use SPC\util\SPCTarget;
|
use SPC\util\SPCTarget;
|
||||||
@@ -190,6 +191,7 @@ class SourcePatcher
|
|||||||
*/
|
*/
|
||||||
public static function patchFile(string $patch_name, string $cwd, bool $reverse = false): bool
|
public static function patchFile(string $patch_name, string $cwd, bool $reverse = false): bool
|
||||||
{
|
{
|
||||||
|
try {
|
||||||
if (FileSystem::isRelativePath($patch_name)) {
|
if (FileSystem::isRelativePath($patch_name)) {
|
||||||
$patch_file = ROOT_DIR . "/src/globals/patch/{$patch_name}";
|
$patch_file = ROOT_DIR . "/src/globals/patch/{$patch_name}";
|
||||||
} else {
|
} else {
|
||||||
@@ -230,6 +232,10 @@ class SourcePatcher
|
|||||||
|
|
||||||
f_passthru($apply_cmd);
|
f_passthru($apply_cmd);
|
||||||
return true;
|
return true;
|
||||||
|
} catch (ExecutionException $e) {
|
||||||
|
// If patch failed, throw exception
|
||||||
|
throw new PatchException($patch_name, "Patch file [{$patch_name}] failed to apply", previous: $e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function patchOpenssl11Darwin(): bool
|
public static function patchOpenssl11Darwin(): bool
|
||||||
|
|||||||
Reference in New Issue
Block a user