Use PatchException instead of ExecutionException for patchFile

This commit is contained in:
crazywhalecc
2025-08-15 12:04:06 +08:00
parent a3ae1eb2f0
commit d0412a88df

View File

@@ -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