diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index ac7efd1e..4965e8ac 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -298,7 +298,7 @@ class Extension // Run compile check if build target is cli // If you need to run some check, overwrite this or add your assert in src/globals/ext-tests/{extension_name}.php $sharedExtensions = $this->getSharedExtensionLoadString(); - [$ret, $out] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n' . $sharedExtensions . ' --ri "' . $this->getDistName() . '"'); + [$ret] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n' . $sharedExtensions . ' --ri "' . $this->getDistName() . '"'); if ($ret !== 0) { throw new ValidationException( "extension {$this->getName()} failed compile check: php-cli returned {$ret}", @@ -328,7 +328,7 @@ class Extension { // Run compile check if build target is cli // If you need to run some check, overwrite this or add your assert in src/globals/ext-tests/{extension_name}.php - [$ret] = cmd()->execWithResult(BUILD_ROOT_PATH . '/bin/php.exe -n --ri "' . $this->getDistName() . '"', false); + [$ret] = cmd()->execWithResult(BUILD_BIN_PATH . '/php.exe -n --ri "' . $this->getDistName() . '"', false); if ($ret !== 0) { throw new ValidationException("extension {$this->getName()} failed compile check: php-cli returned {$ret}", validation_module: "Extension {$this->getName()} sanity check"); } diff --git a/src/SPC/builder/extension/readline.php b/src/SPC/builder/extension/readline.php index b9afd4f9..b12e8b89 100644 --- a/src/SPC/builder/extension/readline.php +++ b/src/SPC/builder/extension/readline.php @@ -5,6 +5,7 @@ declare(strict_types=1); namespace SPC\builder\extension; use SPC\builder\Extension; +use SPC\exception\ValidationException; use SPC\store\FileSystem; use SPC\util\CustomExt; use SPC\util\SPCTarget; @@ -36,6 +37,15 @@ class readline extends Extension parent::buildUnixShared(); } + public function runCliCheckUnix(): void + { + parent::runCliCheckUnix(); + [$ret, $out] = shell()->execWithResult('printf "exit\n" | ' . BUILD_BIN_PATH . '/php -a'); + if ($ret !== 0 || !str_contains(implode("\n", $out), 'Interactive shell')) { + throw new ValidationException("readline extension failed sanity check. Code: {$ret}, output: " . implode("\n", $out)); + } + } + public static function patchCliLinux(bool $patch): void { if (SPCTarget::getTargetOS() === 'Linux' && SPCTarget::isStatic() && $patch) {